@oomol-lab/open-flow 0.1.0-beta.3 → 0.1.0-beta.30
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/browser/{_virtual_open-flow-twemoji-DJwKsM_w.js → _virtual_open-flow-twemoji-CpHJOEsk.js} +4028 -2
- package/dist/browser/carbon-Cn-DTyjG.js +54 -0
- package/dist/browser/createResourceDialog-_y2xHaUA.js +110 -0
- package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
- package/dist/browser/dist-CoszrK7m.js +4 -0
- package/dist/browser/{dist-CPuF50D9.js → dist-D1VYgicl.js} +426 -305
- package/dist/browser/dist-DSe6KRsr.js +1224 -0
- package/dist/browser/dist-DYjIVIZC.js +795 -0
- package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
- package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
- package/dist/browser/{dist-CJpzJrLM.js → dist-DwvhuMxw.js} +894 -895
- package/dist/browser/dist-DxahK_I8.js +2688 -0
- package/dist/browser/{dist-C46JByB-.js → dist-Dz6Nglsd.js} +61 -61
- package/dist/browser/{dist-DUzA0Ukh.js → dist-TJfrvoIQ.js} +141 -142
- package/dist/browser/editorComponent-Dq4IKp5R.js +14790 -0
- package/dist/browser/{esm-C2UUqIUP.js → esm-B7A42FzW.js} +68 -59
- package/dist/browser/event-sources.d.ts +30 -0
- package/dist/browser/flow-authoring-module.d.ts +2 -2
- package/dist/browser/flow-authoring-node.d.ts +26 -8
- package/dist/browser/flow-authoring.d.ts +1 -1
- package/dist/browser/flow-authoring.js +5282 -313
- package/dist/browser/flow-change-schema.d.ts +11 -0
- package/dist/browser/flow-change.d.ts +193 -18
- package/dist/browser/flow-change.js +5192 -137
- package/dist/browser/flow-notifications.d.ts +11 -2
- package/dist/browser/flowChanges-AdN0Iqma.js +12304 -0
- package/dist/browser/{flowRunInputEditorStore-CwvOiIiU.js → flowRunInputEditorStore-CTORQcA2.js} +864 -4000
- package/dist/browser/flowWorkspace-BrtzLKWB.js +153066 -0
- package/dist/browser/host-conformance.d.ts +7 -0
- package/dist/browser/host-conformance.js +39 -0
- package/dist/browser/inputValues-DJfFraxG.js +43 -0
- package/dist/browser/licenses.md +195 -662
- package/dist/browser/lite-BuKZ8joP.js +8545 -0
- package/dist/browser/main-BDnNHhkU.js +50 -0
- package/dist/browser/{markdownContent-DUfLdnUt.js → markdownContent-D2oHGWc6.js} +53 -53
- package/dist/browser/theme.css +527 -34
- package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-DnAmJCzu.js} +70 -71
- package/dist/browser/ui-input.d.ts +5 -0
- package/dist/browser/ui-label.d.ts +3 -0
- package/dist/browser/ui-textarea.d.ts +3 -0
- package/dist/browser/ui.css +2 -0
- package/dist/browser/ui.css.d.ts +1 -0
- package/dist/browser/ui.d.ts +34 -0
- package/dist/browser/ui.js +2632 -0
- package/dist/browser/value-DPg_9yXB.js +93 -0
- package/dist/browser/warmCodeTheme-DVv4-rDO.js +35 -0
- package/dist/browser/workbench-contract.d.ts +27 -2
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +2 -0
- package/dist/browser/workbench.js +2767 -1406
- package/dist/browser/workbenchSelect-BDPIQxYK.js +5967 -0
- package/dist/common/authoringExamples.d.ts +28 -0
- package/dist/common/control-api-conformance.d.ts +7 -0
- package/dist/common/control-api-conformance.js +5568 -171
- package/dist/common/control-api-errors.d.ts +37 -0
- package/dist/common/control-api.d.ts +394 -47
- package/dist/common/control-api.js +6066 -569
- package/dist/common/control-requests.d.ts +98 -0
- package/dist/common/control-requests.js +5412 -0
- package/dist/common/cron-trigger.d.ts +2 -1
- package/dist/common/cron-trigger.js +27 -24
- package/dist/common/draftOperations.d.ts +14 -0
- package/dist/common/engine-contract.d.ts +3 -1
- package/dist/common/event-sources.d.ts +50 -0
- package/dist/common/feishu-events.d.ts +20 -0
- package/dist/common/feishu-subscriptions.d.ts +10 -0
- package/dist/common/flow-agent.d.ts +10 -0
- package/dist/common/flow-encoding.d.ts +16 -2
- package/dist/common/flow-encoding.js +5092 -68
- package/dist/common/flow-graph.d.ts +52 -0
- package/dist/common/flow-json.d.ts +2 -0
- package/dist/common/flow-modules.d.ts +20 -0
- package/dist/common/flow-notifications.d.ts +11 -2
- package/dist/common/flow-schema.d.ts +17 -0
- package/dist/common/flow-semantics.d.ts +12 -6
- package/dist/common/flow-semantics.js +15870 -9668
- package/dist/common/flowInspection.d.ts +16 -0
- package/dist/common/fr-iv1541dF.js +93 -0
- package/dist/common/integration-trigger.d.ts +29 -2
- package/dist/common/integration-trigger.js +192 -56
- package/dist/common/ja-Bq-ZDOD4.js +93 -0
- package/dist/common/ko-Z-k9R2c6.js +93 -0
- package/dist/common/localization.d.ts +2 -0
- package/dist/common/localization.js +37 -1
- package/dist/common/mcp-conformance.d.ts +2 -0
- package/dist/common/mcp.d.ts +767 -0
- package/dist/common/mcp.js +6733 -0
- package/dist/common/poll-trigger.d.ts +5 -0
- package/dist/common/poll-trigger.js +26 -22
- package/dist/common/provider-triggers.d.ts +4 -0
- package/dist/common/provider-triggers.js +7310 -1736
- package/dist/common/ru-B4gFecYZ.js +93 -0
- package/dist/common/run-events.d.ts +2 -2
- package/dist/common/run-events.js +13 -17
- package/dist/common/run-lifecycle.d.ts +21 -2
- package/dist/common/run-lifecycle.js +83 -2
- package/dist/common/run-results.d.ts +57 -0
- package/dist/common/runtime-contract.d.ts +38 -3
- package/dist/common/runtime-contract.js +291 -19
- package/dist/common/scheduler.d.ts +97 -19
- package/dist/common/scheduler.js +8234 -261
- package/dist/common/trigger-catalog.d.ts +17 -0
- package/dist/common/trigger-config-options.d.ts +13 -0
- package/dist/common/trigger-contract.d.ts +5 -0
- package/dist/common/trigger-localization.d.ts +7 -0
- package/dist/common/webhook-trigger.d.ts +3 -3
- package/dist/common/webhook-trigger.js +64 -18
- package/dist/common/zh-CN-ByQ6nYam.js +93 -0
- package/dist/common/zh-TW-QjIarvX9.js +93 -0
- package/dist/index.d.ts +6 -5
- package/package.json +21 -1
- package/dist/browser/carbon-DMCVsjHo.js +0 -53
- package/dist/browser/createResourceDialog-BkZns-oZ.js +0 -504
- package/dist/browser/diagnostics-SDCyFuxm.js +0 -11634
- package/dist/browser/dist-BMqL-qR5.js +0 -1894
- package/dist/browser/dist-BpopSHwP.js +0 -1543
- package/dist/browser/dist-CP0883sY.js +0 -4
- package/dist/browser/dist-CUSrALSX.js +0 -1620
- package/dist/browser/flowWorkspace-BZ_eiQNR.js +0 -45393
- package/dist/browser/getPseudoElementBounds-ESJExRFX.js +0 -7642
- package/dist/browser/languages-DgJehE1g.js +0 -62
- package/dist/browser/main-DmjVyuWr.js +0 -76
- package/dist/browser/workbenchSelect-B2s1HV-Y.js +0 -1374
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
import { S as e, _ as t, a as n, d as r, i, l as a, m as o, o as s, p as c, s as l, v as u, w as d, y as f } from "./dist-Mecbzdl2.js";
|
|
2
|
+
import { C as p, E as m, O as h, T as ee, _ as te, a as ne, b as g, c as re, d as ie, g as ae, p as _, r as v, t as y, u as oe, v as se, w as ce, x as le } from "./dist-BKuSVKCC.js";
|
|
3
|
+
import { _ as ue, c as de, d as fe, h as pe, j as me, w as he } from "./dist-DxahK_I8.js";
|
|
4
|
+
import { i as ge, n as _e, o as ve, r as ye } from "./dist-D1VYgicl.js";
|
|
5
|
+
import { defaultKeymap as be, history as b, historyKeymap as x } from "./dist-DSe6KRsr.js";
|
|
6
|
+
import { t as xe } from "./dist-CeSZ2xSM.js";
|
|
7
|
+
//#region ../../node_modules/.bun/@codemirror+search@6.7.1/node_modules/@codemirror/search/dist/index.js
|
|
8
|
+
var S = typeof String.prototype.normalize == "function" ? (e) => e.normalize("NFKD") : (e) => e, C = class {
|
|
9
|
+
constructor(e, t, n = 0, r = e.length, i, a) {
|
|
10
|
+
this.test = a, this.value = {
|
|
11
|
+
from: 0,
|
|
12
|
+
to: 0,
|
|
13
|
+
precise: !1
|
|
14
|
+
}, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, r), this.bufferStart = n, this.normalize = i ? (e) => i(S(e)) : S, this.query = this.normalize(t);
|
|
15
|
+
}
|
|
16
|
+
peek() {
|
|
17
|
+
if (this.bufferPos == this.buffer.length) {
|
|
18
|
+
if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done) return -1;
|
|
19
|
+
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
20
|
+
}
|
|
21
|
+
return t(this.buffer, this.bufferPos);
|
|
22
|
+
}
|
|
23
|
+
next() {
|
|
24
|
+
for (; this.matches.length;) this.matches.pop();
|
|
25
|
+
return this.nextOverlapping();
|
|
26
|
+
}
|
|
27
|
+
nextOverlapping() {
|
|
28
|
+
for (;;) {
|
|
29
|
+
let e = this.peek();
|
|
30
|
+
if (e < 0) return this.done = !0, this;
|
|
31
|
+
let t = d(e), n = this.bufferStart + this.bufferPos;
|
|
32
|
+
this.bufferPos += u(e);
|
|
33
|
+
let r = this.normalize(t);
|
|
34
|
+
if (r.length) for (let e = 0, i = n, a = !0;; e++) {
|
|
35
|
+
let n = r.charCodeAt(e), o = this.match(n, i, a, this.bufferPos + this.bufferStart, e == r.length - 1);
|
|
36
|
+
if (o) return this.value = o, this;
|
|
37
|
+
if (e == r.length - 1) break;
|
|
38
|
+
a && e < t.length && t.charCodeAt(e) == n ? i++ : a = !1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
match(e, t, n, r, i) {
|
|
43
|
+
let a = null;
|
|
44
|
+
for (let t = 0; t < this.matches.length;) {
|
|
45
|
+
let n = this.matches[t], o = !1;
|
|
46
|
+
this.query.charCodeAt(n.index) == e && (n.index == this.query.length - 1 ? a = {
|
|
47
|
+
from: n.from,
|
|
48
|
+
to: r,
|
|
49
|
+
precise: i && n.precise
|
|
50
|
+
} : (n.index++, o = !0)), o ? t++ : this.matches.splice(t, 1);
|
|
51
|
+
}
|
|
52
|
+
return this.query.charCodeAt(0) == e && (this.query.length == 1 ? a = {
|
|
53
|
+
from: t,
|
|
54
|
+
to: r,
|
|
55
|
+
precise: n && i
|
|
56
|
+
} : this.matches.push({
|
|
57
|
+
from: t,
|
|
58
|
+
index: 1,
|
|
59
|
+
precise: n
|
|
60
|
+
})), a && this.test && !this.test(a.from, a.to, this.buffer, this.bufferStart) && (a = null), a;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
typeof Symbol < "u" && (C.prototype[Symbol.iterator] = function() {
|
|
64
|
+
return this;
|
|
65
|
+
});
|
|
66
|
+
var w = {
|
|
67
|
+
from: -1,
|
|
68
|
+
to: -1,
|
|
69
|
+
match: /*@__PURE__*/ /.*/.exec(""),
|
|
70
|
+
precise: !0
|
|
71
|
+
}, T = "gm" + (/x/.unicode == null ? "" : "u"), E = class {
|
|
72
|
+
constructor(e, t, n, r = 0, i = e.length) {
|
|
73
|
+
if (this.text = e, this.to = i, this.curLine = "", this.done = !1, this.value = w, /\\[sWDnr]|\n|\r|\[\^/.test(t)) return new k(e, t, n, r, i);
|
|
74
|
+
this.re = new RegExp(t, T + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.iter = e.iter();
|
|
75
|
+
let a = e.lineAt(r);
|
|
76
|
+
this.curLineStart = a.from, this.matchPos = A(e, r), this.getLine(this.curLineStart);
|
|
77
|
+
}
|
|
78
|
+
getLine(e) {
|
|
79
|
+
this.iter.next(e), 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());
|
|
80
|
+
}
|
|
81
|
+
nextLine() {
|
|
82
|
+
this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0);
|
|
83
|
+
}
|
|
84
|
+
next() {
|
|
85
|
+
for (let e = this.matchPos - this.curLineStart;;) {
|
|
86
|
+
this.re.lastIndex = e;
|
|
87
|
+
let t = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
88
|
+
if (t) {
|
|
89
|
+
let n = this.curLineStart + t.index, r = n + t[0].length;
|
|
90
|
+
if (this.matchPos = A(this.text, r + +(n == r)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < r || n > this.value.to) && (!this.test || this.test(n, r, t))) return this.value = {
|
|
91
|
+
from: n,
|
|
92
|
+
to: r,
|
|
93
|
+
precise: !0,
|
|
94
|
+
match: t
|
|
95
|
+
}, this;
|
|
96
|
+
e = this.matchPos - this.curLineStart;
|
|
97
|
+
} else if (this.curLineStart + this.curLine.length < this.to) this.nextLine(), e = 0;
|
|
98
|
+
else return this.done = !0, this;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, D = /*@__PURE__*/ new WeakMap(), O = class e {
|
|
102
|
+
constructor(e, t) {
|
|
103
|
+
this.from = e, this.text = t;
|
|
104
|
+
}
|
|
105
|
+
get to() {
|
|
106
|
+
return this.from + this.text.length;
|
|
107
|
+
}
|
|
108
|
+
static get(t, n, r) {
|
|
109
|
+
let i = D.get(t);
|
|
110
|
+
if (!i || i.from >= r || i.to <= n) {
|
|
111
|
+
let i = new e(n, t.sliceString(n, r));
|
|
112
|
+
return D.set(t, i), i;
|
|
113
|
+
}
|
|
114
|
+
if (i.from == n && i.to == r) return i;
|
|
115
|
+
let { text: a, from: o } = i;
|
|
116
|
+
return o > n && (a = t.sliceString(n, o) + a, o = n), i.to < r && (a += t.sliceString(i.to, r)), D.set(t, new e(o, a)), new e(n, a.slice(n - o, r - o));
|
|
117
|
+
}
|
|
118
|
+
}, k = class {
|
|
119
|
+
constructor(e, t, n, r, i) {
|
|
120
|
+
this.text = e, this.to = i, this.done = !1, this.value = w, this.matchPos = A(e, r), this.re = new RegExp(t, T + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.flat = O.get(e, r, this.chunkEnd(r + 5e3));
|
|
121
|
+
}
|
|
122
|
+
chunkEnd(e) {
|
|
123
|
+
return e >= this.to ? this.to : this.text.lineAt(e).to;
|
|
124
|
+
}
|
|
125
|
+
next() {
|
|
126
|
+
for (;;) {
|
|
127
|
+
let e = this.re.lastIndex = this.matchPos - this.flat.from, t = this.re.exec(this.flat.text);
|
|
128
|
+
if (t && !t[0] && t.index == e && (this.re.lastIndex = e + 1, t = this.re.exec(this.flat.text)), t) {
|
|
129
|
+
let e = this.flat.from + t.index, n = e + t[0].length;
|
|
130
|
+
if ((this.flat.to >= this.to || t.index + t[0].length <= this.flat.text.length - 10) && (!this.test || this.test(e, n, t))) return this.value = {
|
|
131
|
+
from: e,
|
|
132
|
+
to: n,
|
|
133
|
+
precise: !0,
|
|
134
|
+
match: t
|
|
135
|
+
}, this.matchPos = A(this.text, n + +(e == n)), this;
|
|
136
|
+
}
|
|
137
|
+
if (this.flat.to == this.to) return this.done = !0, this;
|
|
138
|
+
this.flat = O.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
typeof Symbol < "u" && (E.prototype[Symbol.iterator] = k.prototype[Symbol.iterator] = function() {
|
|
143
|
+
return this;
|
|
144
|
+
});
|
|
145
|
+
function Se(e) {
|
|
146
|
+
try {
|
|
147
|
+
return new RegExp(e, T), !0;
|
|
148
|
+
} catch {
|
|
149
|
+
return !1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function A(e, t) {
|
|
153
|
+
if (t >= e.length) return t;
|
|
154
|
+
let n = e.lineAt(t), r;
|
|
155
|
+
for (; t < n.to && (r = n.text.charCodeAt(t - n.from)) >= 56320 && r < 57344;) t++;
|
|
156
|
+
return t;
|
|
157
|
+
}
|
|
158
|
+
var Ce = (e) => {
|
|
159
|
+
let { state: t } = e, r = String(t.doc.lineAt(e.state.selection.main.head).number), { close: i, result: a } = ee(e, {
|
|
160
|
+
label: t.phrase("Go to line"),
|
|
161
|
+
input: {
|
|
162
|
+
type: "text",
|
|
163
|
+
name: "line",
|
|
164
|
+
value: r
|
|
165
|
+
},
|
|
166
|
+
focus: !0,
|
|
167
|
+
submitLabel: t.phrase("go")
|
|
168
|
+
});
|
|
169
|
+
return a.then((r) => {
|
|
170
|
+
let a = r && /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);
|
|
171
|
+
if (!a) {
|
|
172
|
+
e.dispatch({ effects: i });
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
let o = t.doc.lineAt(t.selection.main.head), [, s, c, l, u] = a, d = l ? +l.slice(1) : 0, f = c ? +c : o.number;
|
|
176
|
+
if (c && u) {
|
|
177
|
+
let e = f / 100;
|
|
178
|
+
s && (e = e * (s == "-" ? -1 : 1) + o.number / t.doc.lines), f = Math.round(t.doc.lines * e);
|
|
179
|
+
} else c && s && (f = f * (s == "-" ? -1 : 1) + o.number);
|
|
180
|
+
let p = t.doc.line(Math.max(1, Math.min(t.doc.lines, f))), m = n.cursor(p.from + Math.max(0, Math.min(d, p.length)));
|
|
181
|
+
e.dispatch({
|
|
182
|
+
effects: [i, v.scrollIntoView(m.from, { y: "center" })],
|
|
183
|
+
selection: m
|
|
184
|
+
});
|
|
185
|
+
}), !0;
|
|
186
|
+
}, we = {
|
|
187
|
+
highlightWordAroundCursor: !1,
|
|
188
|
+
minSelectionLength: 1,
|
|
189
|
+
maxMatches: 100,
|
|
190
|
+
wholeWords: !1
|
|
191
|
+
}, j = /*@__PURE__*/ l.define({ combine(e) {
|
|
192
|
+
return f(e, we, {
|
|
193
|
+
highlightWordAroundCursor: (e, t) => e || t,
|
|
194
|
+
minSelectionLength: Math.min,
|
|
195
|
+
maxMatches: Math.min
|
|
196
|
+
});
|
|
197
|
+
} });
|
|
198
|
+
function Te(e) {
|
|
199
|
+
let t = [Ae, ke];
|
|
200
|
+
return e && t.push(j.of(e)), t;
|
|
201
|
+
}
|
|
202
|
+
var Ee = /*@__PURE__*/ y.mark({ class: "cm-selectionMatch" }), De = /*@__PURE__*/ y.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
203
|
+
function M(e, t, n, r) {
|
|
204
|
+
return (n == 0 || e(t.sliceDoc(n - 1, n)) != i.Word) && (r == t.doc.length || e(t.sliceDoc(r, r + 1)) != i.Word);
|
|
205
|
+
}
|
|
206
|
+
function Oe(e, t, n, r) {
|
|
207
|
+
return e(t.sliceDoc(n, n + 1)) == i.Word && e(t.sliceDoc(r - 1, r)) == i.Word;
|
|
208
|
+
}
|
|
209
|
+
var ke = /*@__PURE__*/ ne.fromClass(class {
|
|
210
|
+
constructor(e) {
|
|
211
|
+
this.decorations = this.getDeco(e);
|
|
212
|
+
}
|
|
213
|
+
update(e) {
|
|
214
|
+
(e.selectionSet || e.docChanged || e.viewportChanged) && (this.decorations = this.getDeco(e.view));
|
|
215
|
+
}
|
|
216
|
+
getDeco(e) {
|
|
217
|
+
let t = e.state.facet(j), { state: n } = e, r = n.selection;
|
|
218
|
+
if (r.ranges.length > 1) return y.none;
|
|
219
|
+
let i = r.main, a, o = null;
|
|
220
|
+
if (i.empty) {
|
|
221
|
+
if (!t.highlightWordAroundCursor) return y.none;
|
|
222
|
+
let e = n.wordAt(i.head);
|
|
223
|
+
if (!e) return y.none;
|
|
224
|
+
o = n.charCategorizer(i.head), a = n.sliceDoc(e.from, e.to);
|
|
225
|
+
} else {
|
|
226
|
+
let e = i.to - i.from;
|
|
227
|
+
if (e < t.minSelectionLength || e > 200) return y.none;
|
|
228
|
+
if (t.wholeWords) {
|
|
229
|
+
if (a = n.sliceDoc(i.from, i.to), o = n.charCategorizer(i.head), !(M(o, n, i.from, i.to) && Oe(o, n, i.from, i.to))) return y.none;
|
|
230
|
+
} else if (a = n.sliceDoc(i.from, i.to), !a) return y.none;
|
|
231
|
+
}
|
|
232
|
+
let s = [];
|
|
233
|
+
for (let r of e.visibleRanges) {
|
|
234
|
+
let e = new C(n.doc, a, r.from, r.to);
|
|
235
|
+
for (; !e.next().done;) {
|
|
236
|
+
let { from: r, to: a } = e.value;
|
|
237
|
+
if ((!o || M(o, n, r, a)) && (i.empty && r <= i.from && a >= i.to ? s.push(De.range(r, a)) : (r >= i.to || a <= i.from) && s.push(Ee.range(r, a)), s.length > t.maxMatches)) return y.none;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return y.set(s);
|
|
241
|
+
}
|
|
242
|
+
}, { decorations: (e) => e.decorations }), Ae = /*@__PURE__*/ v.baseTheme({
|
|
243
|
+
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
244
|
+
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
245
|
+
}), je = ({ state: e, dispatch: t }) => {
|
|
246
|
+
let { selection: r } = e, i = n.create(r.ranges.map((t) => e.wordAt(t.head) || n.cursor(t.head)), r.mainIndex);
|
|
247
|
+
return !i.eq(r) && (t(e.update({ selection: i })), !0);
|
|
248
|
+
};
|
|
249
|
+
function Me(e, t) {
|
|
250
|
+
let { main: n, ranges: r } = e.selection, i = e.wordAt(n.head), a = i && i.from == n.from && i.to == n.to;
|
|
251
|
+
for (let n = !1, i = new C(e.doc, t, r[r.length - 1].to);;) if (i.next(), i.done) {
|
|
252
|
+
if (n) return null;
|
|
253
|
+
i = new C(e.doc, t, 0, Math.max(0, r[r.length - 1].from - 1)), n = !0;
|
|
254
|
+
} else {
|
|
255
|
+
if (n && r.some((e) => e.from == i.value.from)) continue;
|
|
256
|
+
if (a) {
|
|
257
|
+
let t = e.wordAt(i.value.from);
|
|
258
|
+
if (!t || t.from != i.value.from || t.to != i.value.to) continue;
|
|
259
|
+
}
|
|
260
|
+
return i.value;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
var Ne = ({ state: e, dispatch: t }) => {
|
|
264
|
+
let { ranges: r } = e.selection;
|
|
265
|
+
if (r.some((e) => e.from === e.to)) return je({
|
|
266
|
+
state: e,
|
|
267
|
+
dispatch: t
|
|
268
|
+
});
|
|
269
|
+
let i = e.sliceDoc(r[0].from, r[0].to);
|
|
270
|
+
if (e.selection.ranges.some((t) => e.sliceDoc(t.from, t.to) != i)) return !1;
|
|
271
|
+
let a = Me(e, i);
|
|
272
|
+
return a ? (t(e.update({
|
|
273
|
+
selection: e.selection.addRange(n.range(a.from, a.to), !1),
|
|
274
|
+
effects: v.scrollIntoView(a.to)
|
|
275
|
+
})), !0) : !1;
|
|
276
|
+
}, N = /*@__PURE__*/ l.define({ combine(e) {
|
|
277
|
+
return f(e, {
|
|
278
|
+
top: !1,
|
|
279
|
+
caseSensitive: !1,
|
|
280
|
+
literal: !1,
|
|
281
|
+
regexp: !1,
|
|
282
|
+
wholeWord: !1,
|
|
283
|
+
createPanel: (e) => new Ze(e),
|
|
284
|
+
scrollToMatch: (e) => v.scrollIntoView(e)
|
|
285
|
+
});
|
|
286
|
+
} }), P = class {
|
|
287
|
+
constructor(e) {
|
|
288
|
+
this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp || Se(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord, this.test = e.test;
|
|
289
|
+
}
|
|
290
|
+
unquote(e) {
|
|
291
|
+
return this.literal ? e : e.replace(/\\([nrt\\])/g, (e, t) => t == "n" ? "\n" : t == "r" ? "\r" : t == "t" ? " " : "\\");
|
|
292
|
+
}
|
|
293
|
+
eq(e) {
|
|
294
|
+
return this.search == e.search && this.replace == e.replace && this.caseSensitive == e.caseSensitive && this.regexp == e.regexp && this.wholeWord == e.wholeWord && this.test == e.test;
|
|
295
|
+
}
|
|
296
|
+
create() {
|
|
297
|
+
return this.regexp ? new ze(this) : new Ie(this);
|
|
298
|
+
}
|
|
299
|
+
getCursor(e, t = 0, n) {
|
|
300
|
+
let r = e.doc ? e : s.create({ doc: e });
|
|
301
|
+
return n ??= r.doc.length, this.regexp ? L(this, r, t, n) : I(this, r, t, n);
|
|
302
|
+
}
|
|
303
|
+
}, F = class {
|
|
304
|
+
constructor(e) {
|
|
305
|
+
this.spec = e;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
function Pe(e, t, n) {
|
|
309
|
+
return (r, i, a, o) => n && !n(r, i, a, o) ? !1 : e(r >= o && i <= o + a.length ? a.slice(r - o, i - o) : t.doc.sliceString(r, i), t, r, i);
|
|
310
|
+
}
|
|
311
|
+
function I(e, t, n, r) {
|
|
312
|
+
let i;
|
|
313
|
+
return e.wholeWord && (i = Fe(t.doc, t.charCategorizer(t.selection.main.head))), e.test && (i = Pe(e.test, t, i)), new C(t.doc, e.unquoted, n, r, e.caseSensitive ? void 0 : (e) => e.toLowerCase(), i);
|
|
314
|
+
}
|
|
315
|
+
function Fe(e, t) {
|
|
316
|
+
return (n, r, a, o) => ((o > n || o + a.length < r) && (o = Math.max(0, n - 2), a = e.sliceString(o, Math.min(e.length, r + 2))), (t(R(a, n - o)) != i.Word || t(z(a, n - o)) != i.Word) && (t(z(a, r - o)) != i.Word || t(R(a, r - o)) != i.Word));
|
|
317
|
+
}
|
|
318
|
+
var Ie = class extends F {
|
|
319
|
+
constructor(e) {
|
|
320
|
+
super(e);
|
|
321
|
+
}
|
|
322
|
+
nextMatch(e, t, n) {
|
|
323
|
+
let r = I(this.spec, e, n, e.doc.length).nextOverlapping();
|
|
324
|
+
if (r.done) {
|
|
325
|
+
let n = Math.min(e.doc.length, t + this.spec.unquoted.length);
|
|
326
|
+
r = I(this.spec, e, 0, n).nextOverlapping();
|
|
327
|
+
}
|
|
328
|
+
return r.done || r.value.from == t && r.value.to == n ? null : r.value;
|
|
329
|
+
}
|
|
330
|
+
prevMatchInRange(e, t, n) {
|
|
331
|
+
for (let r = n;;) {
|
|
332
|
+
let n = Math.max(t, r - 1e4 - this.spec.unquoted.length), i = I(this.spec, e, n, r), a = null;
|
|
333
|
+
for (; !i.nextOverlapping().done;) a = i.value;
|
|
334
|
+
if (a) return a;
|
|
335
|
+
if (n == t) return null;
|
|
336
|
+
r -= 1e4;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
prevMatch(e, t, n) {
|
|
340
|
+
let r = this.prevMatchInRange(e, 0, t);
|
|
341
|
+
return r ||= this.prevMatchInRange(e, Math.max(0, n - this.spec.unquoted.length), e.doc.length), r && (r.from != t || r.to != n) ? r : null;
|
|
342
|
+
}
|
|
343
|
+
getReplacement(e) {
|
|
344
|
+
return this.spec.unquote(this.spec.replace);
|
|
345
|
+
}
|
|
346
|
+
matchAll(e, t) {
|
|
347
|
+
let n = I(this.spec, e, 0, e.doc.length), r = [];
|
|
348
|
+
for (; !n.next().done;) {
|
|
349
|
+
if (r.length >= t) return null;
|
|
350
|
+
r.push(n.value);
|
|
351
|
+
}
|
|
352
|
+
return r;
|
|
353
|
+
}
|
|
354
|
+
highlight(e, t, n, r) {
|
|
355
|
+
let i = I(this.spec, e, Math.max(0, t - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length));
|
|
356
|
+
for (; !i.next().done;) r(i.value.from, i.value.to);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
function Le(e, t, n) {
|
|
360
|
+
return (r, i, a) => (!n || n(r, i, a)) && e(a[0], t, r, i);
|
|
361
|
+
}
|
|
362
|
+
function L(e, t, n, r) {
|
|
363
|
+
let i;
|
|
364
|
+
return e.wholeWord && (i = Re(t.charCategorizer(t.selection.main.head))), e.test && (i = Le(e.test, t, i)), new E(t.doc, e.search, {
|
|
365
|
+
ignoreCase: !e.caseSensitive,
|
|
366
|
+
test: i
|
|
367
|
+
}, n, r);
|
|
368
|
+
}
|
|
369
|
+
function R(t, n) {
|
|
370
|
+
return t.slice(e(t, n, !1), n);
|
|
371
|
+
}
|
|
372
|
+
function z(t, n) {
|
|
373
|
+
return t.slice(n, e(t, n));
|
|
374
|
+
}
|
|
375
|
+
function Re(e) {
|
|
376
|
+
return (t, n, r) => !r[0].length || (e(R(r.input, r.index)) != i.Word || e(z(r.input, r.index)) != i.Word) && (e(z(r.input, r.index + r[0].length)) != i.Word || e(R(r.input, r.index + r[0].length)) != i.Word);
|
|
377
|
+
}
|
|
378
|
+
var ze = class extends F {
|
|
379
|
+
nextMatch(e, t, n) {
|
|
380
|
+
let r = L(this.spec, e, n, e.doc.length).next();
|
|
381
|
+
return r.done && (r = L(this.spec, e, 0, t).next()), r.done ? null : r.value;
|
|
382
|
+
}
|
|
383
|
+
prevMatchInRange(e, t, n) {
|
|
384
|
+
for (let r = 1;; r++) {
|
|
385
|
+
let i = Math.max(t, n - r * 1e4), a = L(this.spec, e, i, n), o = null;
|
|
386
|
+
for (; !a.next().done;) o = a.value;
|
|
387
|
+
if (o && (i == t || o.from > i + 10)) return o;
|
|
388
|
+
if (i == t) return null;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
prevMatch(e, t, n) {
|
|
392
|
+
return this.prevMatchInRange(e, 0, t) || this.prevMatchInRange(e, n, e.doc.length);
|
|
393
|
+
}
|
|
394
|
+
getReplacement(e) {
|
|
395
|
+
return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (t, n) => {
|
|
396
|
+
if (n == "&") return e.match[0];
|
|
397
|
+
if (n == "$") return "$";
|
|
398
|
+
for (let t = n.length; t > 0; t--) {
|
|
399
|
+
let r = +n.slice(0, t);
|
|
400
|
+
if (r > 0 && r < e.match.length) return e.match[r] + n.slice(t);
|
|
401
|
+
}
|
|
402
|
+
return t;
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
matchAll(e, t) {
|
|
406
|
+
let n = L(this.spec, e, 0, e.doc.length), r = [];
|
|
407
|
+
for (; !n.next().done;) {
|
|
408
|
+
if (r.length >= t) return null;
|
|
409
|
+
r.push(n.value);
|
|
410
|
+
}
|
|
411
|
+
return r;
|
|
412
|
+
}
|
|
413
|
+
highlight(e, t, n, r) {
|
|
414
|
+
let i = L(this.spec, e, Math.max(0, t - 250), Math.min(n + 250, e.doc.length));
|
|
415
|
+
for (; !i.next().done;) r(i.value.from, i.value.to);
|
|
416
|
+
}
|
|
417
|
+
}, B = /*@__PURE__*/ c.define(), V = /*@__PURE__*/ c.define(), H = /*@__PURE__*/ o.define({
|
|
418
|
+
create(e) {
|
|
419
|
+
return new U(J(e).create(), null);
|
|
420
|
+
},
|
|
421
|
+
update(e, t) {
|
|
422
|
+
for (let n of t.effects) n.is(B) ? e = new U(n.value.create(), e.panel) : n.is(V) && (e = new U(e.query, n.value ? q : null));
|
|
423
|
+
return e;
|
|
424
|
+
},
|
|
425
|
+
provide: (e) => m.from(e, (e) => e.panel)
|
|
426
|
+
}), U = class {
|
|
427
|
+
constructor(e, t) {
|
|
428
|
+
this.query = e, this.panel = t;
|
|
429
|
+
}
|
|
430
|
+
}, Be = /*@__PURE__*/ y.mark({ class: "cm-searchMatch" }), Ve = /*@__PURE__*/ y.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), He = /*@__PURE__*/ ne.fromClass(class {
|
|
431
|
+
constructor(e) {
|
|
432
|
+
this.view = e, this.decorations = this.highlight(e.state.field(H));
|
|
433
|
+
}
|
|
434
|
+
update(e) {
|
|
435
|
+
let t = e.state.field(H);
|
|
436
|
+
(t != e.startState.field(H) || e.docChanged || e.selectionSet || e.viewportChanged) && (this.decorations = this.highlight(t));
|
|
437
|
+
}
|
|
438
|
+
highlight({ query: e, panel: t }) {
|
|
439
|
+
if (!t || !e.spec.valid) return y.none;
|
|
440
|
+
let { view: n } = this, i = new r();
|
|
441
|
+
for (let t = 0, r = n.visibleRanges, a = r.length; t < a; t++) {
|
|
442
|
+
let { from: o, to: s } = r[t];
|
|
443
|
+
for (; t < a - 1 && s > r[t + 1].from - 500;) s = r[++t].to;
|
|
444
|
+
e.highlight(n.state, o, s, (e, t) => {
|
|
445
|
+
let r = n.state.selection.ranges.some((n) => n.from == e && n.to == t);
|
|
446
|
+
i.add(e, t, r ? Ve : Be);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return i.finish();
|
|
450
|
+
}
|
|
451
|
+
}, { decorations: (e) => e.decorations });
|
|
452
|
+
function W(e) {
|
|
453
|
+
return (t) => {
|
|
454
|
+
let n = t.state.field(H, !1);
|
|
455
|
+
return n && n.query.spec.valid ? e(t, n) : Y(t);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
var G = /*@__PURE__*/ W((e, { query: t }) => {
|
|
459
|
+
let { to: r } = e.state.selection.main, i = t.nextMatch(e.state, r, r);
|
|
460
|
+
if (!i) return !1;
|
|
461
|
+
let a = n.single(i.from, i.to), o = e.state.facet(N);
|
|
462
|
+
return e.dispatch({
|
|
463
|
+
selection: a,
|
|
464
|
+
effects: [$(e, i), o.scrollToMatch(a.main, e)],
|
|
465
|
+
userEvent: "select.search"
|
|
466
|
+
}), Je(e), !0;
|
|
467
|
+
}), K = /*@__PURE__*/ W((e, { query: t }) => {
|
|
468
|
+
let { state: r } = e, { from: i } = r.selection.main, a = t.prevMatch(r, i, i);
|
|
469
|
+
if (!a) return !1;
|
|
470
|
+
let o = n.single(a.from, a.to), s = e.state.facet(N);
|
|
471
|
+
return e.dispatch({
|
|
472
|
+
selection: o,
|
|
473
|
+
effects: [$(e, a), s.scrollToMatch(o.main, e)],
|
|
474
|
+
userEvent: "select.search"
|
|
475
|
+
}), Je(e), !0;
|
|
476
|
+
}), Ue = /*@__PURE__*/ W((e, { query: t }) => {
|
|
477
|
+
let r = t.matchAll(e.state, 1e3);
|
|
478
|
+
return !r || !r.length ? !1 : (e.dispatch({
|
|
479
|
+
selection: n.create(r.map((e) => n.range(e.from, e.to))),
|
|
480
|
+
userEvent: "select.search.matches"
|
|
481
|
+
}), !0);
|
|
482
|
+
}), We = ({ state: e, dispatch: t }) => {
|
|
483
|
+
let r = e.selection;
|
|
484
|
+
if (r.ranges.length > 1 || r.main.empty) return !1;
|
|
485
|
+
let { from: i, to: a } = r.main, o = [], s = 0;
|
|
486
|
+
for (let t = new C(e.doc, e.sliceDoc(i, a)); !t.next().done;) {
|
|
487
|
+
if (o.length > 1e3) return !1;
|
|
488
|
+
t.value.from == i && (s = o.length), o.push(n.range(t.value.from, t.value.to));
|
|
489
|
+
}
|
|
490
|
+
return t(e.update({
|
|
491
|
+
selection: n.create(o, s),
|
|
492
|
+
userEvent: "select.search.matches"
|
|
493
|
+
})), !0;
|
|
494
|
+
}, Ge = /*@__PURE__*/ W((e, { query: t }) => {
|
|
495
|
+
let { state: r } = e, { from: i, to: a } = r.selection.main;
|
|
496
|
+
if (r.readOnly) return !1;
|
|
497
|
+
let o = t.nextMatch(r, i, i);
|
|
498
|
+
if (!o) return !1;
|
|
499
|
+
let s = o, c = [], l, u, d = [];
|
|
500
|
+
s.precise ? s.from == i && s.to == a && (u = r.toText(t.getReplacement(s)), c.push({
|
|
501
|
+
from: s.from,
|
|
502
|
+
to: s.to,
|
|
503
|
+
insert: u
|
|
504
|
+
}), s = t.nextMatch(r, s.from, s.to), d.push(v.announce.of(r.phrase("replaced match on line $", r.doc.lineAt(i).number) + "."))) : s = t.nextMatch(r, s.from, s.to);
|
|
505
|
+
let f = e.state.changes(c);
|
|
506
|
+
return s && (l = n.single(s.from, s.to).map(f), d.push($(e, s)), d.push(r.facet(N).scrollToMatch(l.main, e))), e.dispatch({
|
|
507
|
+
changes: f,
|
|
508
|
+
selection: l,
|
|
509
|
+
effects: d,
|
|
510
|
+
userEvent: "input.replace"
|
|
511
|
+
}), !0;
|
|
512
|
+
}), Ke = /*@__PURE__*/ W((e, { query: t }) => {
|
|
513
|
+
if (e.state.readOnly) return !1;
|
|
514
|
+
let n = [];
|
|
515
|
+
for (let r of t.matchAll(e.state, 1e9)) {
|
|
516
|
+
let { from: e, to: i, precise: a } = r;
|
|
517
|
+
a && n.push({
|
|
518
|
+
from: e,
|
|
519
|
+
to: i,
|
|
520
|
+
insert: t.getReplacement(r)
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
if (!n.length) return !1;
|
|
524
|
+
let r = e.state.phrase("replaced $ matches", n.length) + ".";
|
|
525
|
+
return e.dispatch({
|
|
526
|
+
changes: n,
|
|
527
|
+
effects: v.announce.of(r),
|
|
528
|
+
userEvent: "input.replace.all"
|
|
529
|
+
}), !0;
|
|
530
|
+
});
|
|
531
|
+
function q(e) {
|
|
532
|
+
return e.state.facet(N).createPanel(e);
|
|
533
|
+
}
|
|
534
|
+
function J(e, t) {
|
|
535
|
+
let n = e.selection.main, r = n.empty || n.to > n.from + 100 ? "" : e.sliceDoc(n.from, n.to);
|
|
536
|
+
if (t && !r) return t;
|
|
537
|
+
let i = e.facet(N);
|
|
538
|
+
return new P({
|
|
539
|
+
search: t?.literal ?? i.literal ? r : r.replace(/\n/g, "\\n"),
|
|
540
|
+
caseSensitive: t?.caseSensitive ?? i.caseSensitive,
|
|
541
|
+
literal: t?.literal ?? i.literal,
|
|
542
|
+
regexp: t?.regexp ?? i.regexp,
|
|
543
|
+
wholeWord: t?.wholeWord ?? i.wholeWord
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
function qe(e) {
|
|
547
|
+
let t = _(e, q);
|
|
548
|
+
return t && t.dom.querySelector("[main-field]");
|
|
549
|
+
}
|
|
550
|
+
function Je(e) {
|
|
551
|
+
let t = qe(e);
|
|
552
|
+
t && t == e.root.activeElement && t.select();
|
|
553
|
+
}
|
|
554
|
+
var Y = (e) => {
|
|
555
|
+
let t = e.state.field(H, !1);
|
|
556
|
+
if (t && t.panel) {
|
|
557
|
+
let n = qe(e);
|
|
558
|
+
if (n && n != e.root.activeElement) {
|
|
559
|
+
let r = J(e.state, t.query.spec);
|
|
560
|
+
r.valid && e.dispatch({ effects: B.of(r) }), n.focus(), n.select();
|
|
561
|
+
}
|
|
562
|
+
} else e.dispatch({ effects: [V.of(!0), t ? B.of(J(e.state, t.query.spec)) : c.appendConfig.of($e)] });
|
|
563
|
+
return !0;
|
|
564
|
+
}, Ye = (e) => {
|
|
565
|
+
let t = e.state.field(H, !1);
|
|
566
|
+
if (!t || !t.panel) return !1;
|
|
567
|
+
let n = _(e, q);
|
|
568
|
+
return n && n.dom.contains(e.root.activeElement) && e.focus(), e.dispatch({ effects: V.of(!1) }), !0;
|
|
569
|
+
}, Xe = [
|
|
570
|
+
{
|
|
571
|
+
key: "Mod-f",
|
|
572
|
+
run: Y,
|
|
573
|
+
scope: "editor search-panel"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
key: "F3",
|
|
577
|
+
run: G,
|
|
578
|
+
shift: K,
|
|
579
|
+
scope: "editor search-panel",
|
|
580
|
+
preventDefault: !0
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
key: "Mod-g",
|
|
584
|
+
run: G,
|
|
585
|
+
shift: K,
|
|
586
|
+
scope: "editor search-panel",
|
|
587
|
+
preventDefault: !0
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
key: "Escape",
|
|
591
|
+
run: Ye,
|
|
592
|
+
scope: "editor search-panel"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
key: "Mod-Shift-l",
|
|
596
|
+
run: We
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
key: "Mod-Alt-g",
|
|
600
|
+
run: Ce
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
key: "Mod-d",
|
|
604
|
+
run: Ne,
|
|
605
|
+
preventDefault: !0
|
|
606
|
+
}
|
|
607
|
+
], Ze = class {
|
|
608
|
+
constructor(e) {
|
|
609
|
+
this.view = e;
|
|
610
|
+
let t = this.query = e.state.field(H).query.spec;
|
|
611
|
+
this.commit = this.commit.bind(this), this.searchField = h("input", {
|
|
612
|
+
value: t.search,
|
|
613
|
+
placeholder: X(e, "Find"),
|
|
614
|
+
"aria-label": X(e, "Find"),
|
|
615
|
+
class: "cm-textfield",
|
|
616
|
+
name: "search",
|
|
617
|
+
form: "",
|
|
618
|
+
"main-field": "true",
|
|
619
|
+
onchange: this.commit,
|
|
620
|
+
onkeyup: this.commit
|
|
621
|
+
}), this.replaceField = h("input", {
|
|
622
|
+
value: t.replace,
|
|
623
|
+
placeholder: X(e, "Replace"),
|
|
624
|
+
"aria-label": X(e, "Replace"),
|
|
625
|
+
class: "cm-textfield",
|
|
626
|
+
name: "replace",
|
|
627
|
+
form: "",
|
|
628
|
+
onchange: this.commit,
|
|
629
|
+
onkeyup: this.commit
|
|
630
|
+
}), this.caseField = h("input", {
|
|
631
|
+
type: "checkbox",
|
|
632
|
+
name: "case",
|
|
633
|
+
form: "",
|
|
634
|
+
checked: t.caseSensitive,
|
|
635
|
+
onchange: this.commit
|
|
636
|
+
}), this.reField = h("input", {
|
|
637
|
+
type: "checkbox",
|
|
638
|
+
name: "re",
|
|
639
|
+
form: "",
|
|
640
|
+
checked: t.regexp,
|
|
641
|
+
onchange: this.commit
|
|
642
|
+
}), this.wordField = h("input", {
|
|
643
|
+
type: "checkbox",
|
|
644
|
+
name: "word",
|
|
645
|
+
form: "",
|
|
646
|
+
checked: t.wholeWord,
|
|
647
|
+
onchange: this.commit
|
|
648
|
+
});
|
|
649
|
+
function n(e, t, n) {
|
|
650
|
+
return h("button", {
|
|
651
|
+
class: "cm-button",
|
|
652
|
+
name: e,
|
|
653
|
+
onclick: t,
|
|
654
|
+
type: "button"
|
|
655
|
+
}, n);
|
|
656
|
+
}
|
|
657
|
+
this.dom = h("div", {
|
|
658
|
+
onkeydown: (e) => this.keydown(e),
|
|
659
|
+
class: "cm-search"
|
|
660
|
+
}, [
|
|
661
|
+
this.searchField,
|
|
662
|
+
n("next", () => G(e), [X(e, "next")]),
|
|
663
|
+
n("prev", () => K(e), [X(e, "previous")]),
|
|
664
|
+
n("select", () => Ue(e), [X(e, "all")]),
|
|
665
|
+
h("label", null, [this.caseField, X(e, "match case")]),
|
|
666
|
+
h("label", null, [this.reField, X(e, "regexp")]),
|
|
667
|
+
h("label", null, [this.wordField, X(e, "by word")]),
|
|
668
|
+
...e.state.readOnly ? [] : [
|
|
669
|
+
h("br"),
|
|
670
|
+
this.replaceField,
|
|
671
|
+
n("replace", () => Ge(e), [X(e, "replace")]),
|
|
672
|
+
n("replaceAll", () => Ke(e), [X(e, "replace all")])
|
|
673
|
+
],
|
|
674
|
+
h("button", {
|
|
675
|
+
name: "close",
|
|
676
|
+
onclick: () => Ye(e),
|
|
677
|
+
"aria-label": X(e, "close"),
|
|
678
|
+
type: "button"
|
|
679
|
+
}, ["×"])
|
|
680
|
+
]);
|
|
681
|
+
}
|
|
682
|
+
commit() {
|
|
683
|
+
let e = new P({
|
|
684
|
+
search: this.searchField.value,
|
|
685
|
+
caseSensitive: this.caseField.checked,
|
|
686
|
+
regexp: this.reField.checked,
|
|
687
|
+
wholeWord: this.wordField.checked,
|
|
688
|
+
replace: this.replaceField.value
|
|
689
|
+
});
|
|
690
|
+
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: B.of(e) }));
|
|
691
|
+
}
|
|
692
|
+
keydown(e) {
|
|
693
|
+
ce(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? K : G)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), Ge(this.view));
|
|
694
|
+
}
|
|
695
|
+
update(e) {
|
|
696
|
+
for (let t of e.transactions) for (let e of t.effects) e.is(B) && !e.value.eq(this.query) && this.setQuery(e.value);
|
|
697
|
+
}
|
|
698
|
+
setQuery(e) {
|
|
699
|
+
this.query = e, this.searchField.value = e.search, this.replaceField.value = e.replace, this.caseField.checked = e.caseSensitive, this.reField.checked = e.regexp, this.wordField.checked = e.wholeWord;
|
|
700
|
+
}
|
|
701
|
+
mount() {
|
|
702
|
+
this.searchField.select();
|
|
703
|
+
}
|
|
704
|
+
get pos() {
|
|
705
|
+
return 80;
|
|
706
|
+
}
|
|
707
|
+
get top() {
|
|
708
|
+
return this.view.state.facet(N).top;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
function X(e, t) {
|
|
712
|
+
return e.state.phrase(t);
|
|
713
|
+
}
|
|
714
|
+
var Z = 30, Q = /[\s\.,:;?!]/;
|
|
715
|
+
function $(e, { from: t, to: n }) {
|
|
716
|
+
let r = e.state.doc.lineAt(t), i = e.state.doc.lineAt(n).to, a = Math.max(r.from, t - Z), o = Math.min(i, n + Z), s = e.state.sliceDoc(a, o);
|
|
717
|
+
if (a != r.from) {
|
|
718
|
+
for (let e = 0; e < Z; e++) if (!Q.test(s[e + 1]) && Q.test(s[e])) {
|
|
719
|
+
s = s.slice(e);
|
|
720
|
+
break;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
if (o != i) {
|
|
724
|
+
for (let e = s.length - 1; e > s.length - Z; e--) if (!Q.test(s[e - 1]) && Q.test(s[e])) {
|
|
725
|
+
s = s.slice(0, e);
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return v.announce.of(`${e.state.phrase("current match")}. ${s} ${e.state.phrase("on line")} ${r.number}.`);
|
|
730
|
+
}
|
|
731
|
+
var Qe = /*@__PURE__*/ v.baseTheme({
|
|
732
|
+
".cm-panel.cm-search": {
|
|
733
|
+
padding: "2px 6px 4px",
|
|
734
|
+
position: "relative",
|
|
735
|
+
"& [name=close]": {
|
|
736
|
+
position: "absolute",
|
|
737
|
+
top: "0",
|
|
738
|
+
right: "4px",
|
|
739
|
+
backgroundColor: "inherit",
|
|
740
|
+
border: "none",
|
|
741
|
+
font: "inherit",
|
|
742
|
+
padding: 0,
|
|
743
|
+
margin: 0
|
|
744
|
+
},
|
|
745
|
+
"& input, & button, & label": { margin: ".2em .6em .2em 0" },
|
|
746
|
+
"& input[type=checkbox]": { marginRight: ".2em" },
|
|
747
|
+
"& label": {
|
|
748
|
+
fontSize: "80%",
|
|
749
|
+
whiteSpace: "pre"
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
"&light .cm-searchMatch": { backgroundColor: "#ffff0054" },
|
|
753
|
+
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
754
|
+
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
755
|
+
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
756
|
+
}), $e = [
|
|
757
|
+
H,
|
|
758
|
+
/*@__PURE__*/ a.low(He),
|
|
759
|
+
Qe
|
|
760
|
+
], et = [
|
|
761
|
+
le(),
|
|
762
|
+
te(),
|
|
763
|
+
se(),
|
|
764
|
+
b(),
|
|
765
|
+
pe(),
|
|
766
|
+
oe(),
|
|
767
|
+
ie(),
|
|
768
|
+
s.allowMultipleSelections.of(!0),
|
|
769
|
+
he(),
|
|
770
|
+
me(fe, { fallback: !0 }),
|
|
771
|
+
de(),
|
|
772
|
+
ye(),
|
|
773
|
+
_e(),
|
|
774
|
+
p(),
|
|
775
|
+
re(),
|
|
776
|
+
ae(),
|
|
777
|
+
Te(),
|
|
778
|
+
g.of([
|
|
779
|
+
...ge,
|
|
780
|
+
...be,
|
|
781
|
+
...Xe,
|
|
782
|
+
...x,
|
|
783
|
+
...ue,
|
|
784
|
+
...ve,
|
|
785
|
+
...xe
|
|
786
|
+
])
|
|
787
|
+
], tt = [
|
|
788
|
+
se(),
|
|
789
|
+
b(),
|
|
790
|
+
oe(),
|
|
791
|
+
me(fe, { fallback: !0 }),
|
|
792
|
+
g.of([...be, ...x])
|
|
793
|
+
];
|
|
794
|
+
//#endregion
|
|
795
|
+
export { v as EditorView, et as basicSetup, tt as minimalSetup };
|