@gsc-basic/components 1.0.1 → 1.0.3
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/README.md +59 -0
- package/dist/es/index.js +48 -30
- package/dist/es/node_modules/@codemirror/autocomplete/dist/index.js +15 -15
- package/dist/es/node_modules/@codemirror/commands/dist/index.js +31 -25
- package/dist/es/node_modules/@codemirror/lang-java/dist/index.js +3 -3
- package/dist/es/node_modules/@codemirror/lang-javascript/dist/index.js +8 -8
- package/dist/es/node_modules/@codemirror/lang-json/dist/index.js +1 -1
- package/dist/es/node_modules/@codemirror/lang-python/dist/index.js +1 -1
- package/dist/es/node_modules/@codemirror/lang-sql/dist/index.js +6 -6
- package/dist/es/node_modules/@codemirror/lang-xml/dist/index.js +3 -3
- package/dist/es/node_modules/@codemirror/lang-yaml/dist/index.js +1 -1
- package/dist/es/node_modules/@codemirror/language/dist/index.js +77 -77
- package/dist/es/node_modules/@codemirror/lint/dist/index.js +7 -7
- package/dist/es/node_modules/@codemirror/search/dist/index.js +432 -465
- package/dist/es/node_modules/@codemirror/state/dist/index.js +272 -268
- package/dist/es/node_modules/@codemirror/view/dist/index.js +1732 -1647
- package/dist/es/node_modules/@lezer/common/dist/index.js +191 -190
- package/dist/es/node_modules/@lezer/lr/dist/index.js +5 -3
- package/dist/es/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js +178 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/EventClient.js +13 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/FieldApi.js +406 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/FormApi.js +772 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js +55 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/metaHelper.js +109 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js +45 -0
- package/dist/es/node_modules/@tanstack/form-core/dist/esm/utils.js +213 -0
- package/dist/es/node_modules/@tanstack/pacer-lite/dist/lite-throttler.js +29 -0
- package/dist/es/node_modules/@tanstack/store/dist/esm/derived.js +74 -0
- package/dist/es/node_modules/@tanstack/store/dist/esm/scheduler.js +79 -0
- package/dist/es/node_modules/@tanstack/store/dist/esm/store.js +21 -0
- package/dist/es/node_modules/@tanstack/store/dist/esm/types.js +6 -0
- package/dist/es/node_modules/@tanstack/table-core/build/lib/index.js +1885 -0
- package/dist/es/node_modules/@tanstack/vue-form/dist/esm/useField.js +38 -0
- package/dist/es/node_modules/@tanstack/vue-form/dist/esm/useForm.js +33 -0
- package/dist/es/node_modules/@tanstack/vue-store/dist/esm/index.js +48 -0
- package/dist/es/node_modules/@tanstack/vue-table/build/lib/index.js +159 -0
- package/dist/es/node_modules/@vueuse/core/dist/index.js +1 -1
- package/dist/es/node_modules/codemirror/dist/index.js +3 -3
- package/dist/es/src/Button/index.js +6 -0
- package/dist/es/src/Button/src/Button.css +1 -0
- package/dist/es/src/Button/src/Button.vue.js +41 -0
- package/dist/es/src/Button/src/Button2.css +1 -0
- package/dist/es/src/CodeEditor/src/index.css +1 -1
- package/dist/es/src/CodeEditor/src/index.vue.js +54 -51
- package/dist/es/src/CodeEditor/src/index2.css +1 -1
- package/dist/es/src/ConfigProvider/index.js +1 -2
- package/dist/es/src/ConfigProvider/src/useGlobalConfig.js +9 -9
- package/dist/es/src/Form/index.js +6 -0
- package/dist/es/src/Form/src/Form.css +1 -0
- package/dist/es/src/Form/src/Form.vue.js +208 -0
- package/dist/es/src/Form/src/styles/form.css +1 -0
- package/dist/es/src/Grid/index.js +6 -0
- package/dist/es/src/Grid/src/Grid.css +1 -0
- package/dist/es/src/Grid/src/Grid.vue.js +180 -0
- package/dist/es/src/Grid/src/components/ActionBar.css +1 -0
- package/dist/es/src/Grid/src/components/ActionBar.vue.js +65 -0
- package/dist/es/src/Grid/src/components/CellEditor.css +1 -0
- package/dist/es/src/Grid/src/components/CellEditor.vue.js +132 -0
- package/dist/es/src/Grid/src/components/CellEditor2.css +1 -0
- package/dist/es/src/Grid/src/components/ColumnFilter.css +1 -0
- package/dist/es/src/Grid/src/components/ColumnFilter.vue.js +72 -0
- package/dist/es/src/Grid/src/components/ColumnSettings.css +1 -0
- package/dist/es/src/Grid/src/components/ColumnSettings.vue.js +109 -0
- package/dist/es/src/Grid/src/components/DataTable.css +1 -0
- package/dist/es/src/Grid/src/components/DataTable.vue.js +556 -0
- package/dist/es/src/Grid/src/components/Pager.css +1 -0
- package/dist/es/src/Grid/src/components/Pager.vue.js +64 -0
- package/dist/es/src/Grid/src/components/QueryBar.css +1 -0
- package/dist/es/src/Grid/src/components/QueryBar.vue.js +156 -0
- package/dist/es/src/Grid/src/composables/useCellEditor.js +20 -0
- package/dist/es/src/Grid/src/composables/useGridTable.js +213 -0
- package/dist/es/src/Grid/src/styles/table.css +1 -0
- package/dist/es/src/Overlay/index.js +61 -0
- package/dist/es/src/Overlay/src/Message.css +1 -0
- package/dist/es/src/Overlay/src/Message.vue.js +36 -0
- package/dist/es/src/Overlay/src/Message2.css +1 -0
- package/dist/es/src/Overlay/src/Modal.css +1 -0
- package/dist/es/src/Overlay/src/Modal.vue.js +67 -0
- package/dist/es/src/Overlay/src/Modal2.css +1 -0
- package/dist/es/src/Overlay/src/Notice.css +1 -0
- package/dist/es/src/Overlay/src/Notice.vue.js +37 -0
- package/dist/es/src/Overlay/src/Notice2.css +1 -0
- package/dist/es/src/ScaleScreen/src/index.vue.js +2 -2
- package/dist/es/src/VideoBackground/src/index.vue.js +8 -8
- package/dist/es/src/index.js +35 -19
- package/dist/es/src/locale/lang/en-US.js +40 -0
- package/dist/es/src/locale/lang/ja-JP.js +42 -2
- package/dist/es/src/locale/lang/zh-CN.js +42 -2
- package/dist/es/src/styles/tokens.css +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/node_modules/@codemirror/commands/dist/index.js +1 -1
- package/dist/lib/node_modules/@codemirror/language/dist/index.js +1 -1
- package/dist/lib/node_modules/@codemirror/search/dist/index.js +2 -2
- package/dist/lib/node_modules/@codemirror/state/dist/index.js +4 -4
- package/dist/lib/node_modules/@codemirror/view/dist/index.js +5 -5
- package/dist/lib/node_modules/@lezer/common/dist/index.js +1 -1
- package/dist/lib/node_modules/@lezer/lr/dist/index.js +1 -1
- package/dist/lib/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/EventClient.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/FieldApi.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/FormApi.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/metaHelper.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js +1 -0
- package/dist/lib/node_modules/@tanstack/form-core/dist/esm/utils.js +1 -0
- package/dist/lib/node_modules/@tanstack/pacer-lite/dist/lite-throttler.js +1 -0
- package/dist/lib/node_modules/@tanstack/store/dist/esm/derived.js +1 -0
- package/dist/lib/node_modules/@tanstack/store/dist/esm/scheduler.js +1 -0
- package/dist/lib/node_modules/@tanstack/store/dist/esm/store.js +1 -0
- package/dist/lib/node_modules/@tanstack/store/dist/esm/types.js +1 -0
- package/dist/lib/node_modules/@tanstack/table-core/build/lib/index.js +4 -0
- package/dist/lib/node_modules/@tanstack/vue-form/dist/esm/useField.js +1 -0
- package/dist/lib/node_modules/@tanstack/vue-form/dist/esm/useForm.js +1 -0
- package/dist/lib/node_modules/@tanstack/vue-store/dist/esm/index.js +1 -0
- package/dist/lib/node_modules/@tanstack/vue-table/build/lib/index.js +1 -0
- package/dist/lib/src/Button/index.js +1 -0
- package/dist/lib/src/Button/src/Button.css +1 -0
- package/dist/lib/src/Button/src/Button.vue.js +1 -0
- package/dist/lib/src/Button/src/Button2.css +1 -0
- package/dist/lib/src/CodeEditor/src/index.css +1 -1
- package/dist/lib/src/CodeEditor/src/index.vue.js +1 -1
- package/dist/lib/src/CodeEditor/src/index2.css +1 -1
- package/dist/lib/src/ConfigProvider/index.js +1 -1
- package/dist/lib/src/Form/index.js +1 -0
- package/dist/lib/src/Form/src/Form.css +1 -0
- package/dist/lib/src/Form/src/Form.vue.js +1 -0
- package/dist/lib/src/Form/src/styles/form.css +1 -0
- package/dist/lib/src/Grid/index.js +1 -0
- package/dist/lib/src/Grid/src/Grid.css +1 -0
- package/dist/lib/src/Grid/src/Grid.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/ActionBar.css +1 -0
- package/dist/lib/src/Grid/src/components/ActionBar.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/CellEditor.css +1 -0
- package/dist/lib/src/Grid/src/components/CellEditor.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/CellEditor2.css +1 -0
- package/dist/lib/src/Grid/src/components/ColumnFilter.css +1 -0
- package/dist/lib/src/Grid/src/components/ColumnFilter.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/ColumnSettings.css +1 -0
- package/dist/lib/src/Grid/src/components/ColumnSettings.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/DataTable.css +1 -0
- package/dist/lib/src/Grid/src/components/DataTable.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/Pager.css +1 -0
- package/dist/lib/src/Grid/src/components/Pager.vue.js +1 -0
- package/dist/lib/src/Grid/src/components/QueryBar.css +1 -0
- package/dist/lib/src/Grid/src/components/QueryBar.vue.js +1 -0
- package/dist/lib/src/Grid/src/composables/useCellEditor.js +1 -0
- package/dist/lib/src/Grid/src/composables/useGridTable.js +1 -0
- package/dist/lib/src/Grid/src/styles/table.css +1 -0
- package/dist/lib/src/Overlay/index.js +1 -0
- package/dist/lib/src/Overlay/src/Message.css +1 -0
- package/dist/lib/src/Overlay/src/Message.vue.js +1 -0
- package/dist/lib/src/Overlay/src/Message2.css +1 -0
- package/dist/lib/src/Overlay/src/Modal.css +1 -0
- package/dist/lib/src/Overlay/src/Modal.vue.js +1 -0
- package/dist/lib/src/Overlay/src/Modal2.css +1 -0
- package/dist/lib/src/Overlay/src/Notice.css +1 -0
- package/dist/lib/src/Overlay/src/Notice.vue.js +1 -0
- package/dist/lib/src/Overlay/src/Notice2.css +1 -0
- package/dist/lib/src/index.js +1 -1
- package/dist/lib/src/locale/lang/en-US.js +1 -1
- package/dist/lib/src/locale/lang/ja-JP.js +1 -1
- package/dist/lib/src/locale/lang/zh-CN.js +1 -1
- package/dist/lib/src/styles/tokens.css +1 -1
- package/package.json +11 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
import { getPanel as J, showDialog as he, EditorView as S, ViewPlugin as U, Decoration as f, showPanel as ae, runScopeHandlers as ue } from "../../view/dist/index.js";
|
|
2
|
+
import { StateEffect as Q, EditorSelection as p, StateField as fe, Prec as de, codePointAt as me, codePointSize as ge, Facet as X, combineConfig as Y, CharCategory as g, EditorState as pe, RangeSetBuilder as xe, fromCodePoint as Se, findClusterBreak as Z } from "../../state/dist/index.js";
|
|
3
|
+
import m from "../../../crelt/index.js";
|
|
4
|
+
const K = typeof String.prototype.normalize == "function" ? (r) => r.normalize("NFKD") : (r) => r;
|
|
5
|
+
class C {
|
|
6
6
|
/**
|
|
7
7
|
Create a text cursor. The query is the search string, `from` to
|
|
8
8
|
`to` provides the region to search.
|
|
@@ -16,8 +16,8 @@ class v {
|
|
|
16
16
|
[`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
17
17
|
(when supported).
|
|
18
18
|
*/
|
|
19
|
-
constructor(e,
|
|
20
|
-
this.test = l, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(
|
|
19
|
+
constructor(e, t, n = 0, i = e.length, s, l) {
|
|
20
|
+
this.test = l, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, i), this.bufferStart = n, this.normalize = s ? (c) => s(K(c)) : K, this.query = this.normalize(t);
|
|
21
21
|
}
|
|
22
22
|
peek() {
|
|
23
23
|
if (this.bufferPos == this.buffer.length) {
|
|
@@ -25,7 +25,7 @@ class v {
|
|
|
25
25
|
return -1;
|
|
26
26
|
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return me(this.buffer, this.bufferPos);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
Look for the next match. Updates the iterator's
|
|
@@ -48,46 +48,46 @@ class v {
|
|
|
48
48
|
let e = this.peek();
|
|
49
49
|
if (e < 0)
|
|
50
50
|
return this.done = !0, this;
|
|
51
|
-
let
|
|
52
|
-
this.bufferPos +=
|
|
53
|
-
let i = this.normalize(
|
|
51
|
+
let t = Se(e), n = this.bufferStart + this.bufferPos;
|
|
52
|
+
this.bufferPos += ge(e);
|
|
53
|
+
let i = this.normalize(t);
|
|
54
54
|
if (i.length)
|
|
55
|
-
for (let s = 0, l =
|
|
56
|
-
let
|
|
55
|
+
for (let s = 0, l = n; ; s++) {
|
|
56
|
+
let c = i.charCodeAt(s), o = this.match(c, l, this.bufferPos + this.bufferStart);
|
|
57
57
|
if (s == i.length - 1) {
|
|
58
|
-
if (
|
|
59
|
-
return this.value =
|
|
58
|
+
if (o)
|
|
59
|
+
return this.value = o, this;
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
|
-
l ==
|
|
62
|
+
l == n && s < t.length && t.charCodeAt(s) == c && l++;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
match(e,
|
|
66
|
+
match(e, t, n) {
|
|
67
67
|
let i = null;
|
|
68
68
|
for (let s = 0; s < this.matches.length; s += 2) {
|
|
69
|
-
let l = this.matches[s],
|
|
70
|
-
this.query.charCodeAt(l) == e && (l == this.query.length - 1 ? i = { from: this.matches[s + 1], to:
|
|
69
|
+
let l = this.matches[s], c = !1;
|
|
70
|
+
this.query.charCodeAt(l) == e && (l == this.query.length - 1 ? i = { from: this.matches[s + 1], to: n } : (this.matches[s]++, c = !0)), c || (this.matches.splice(s, 2), s -= 2);
|
|
71
71
|
}
|
|
72
|
-
return this.query.charCodeAt(0) == e && (this.query.length == 1 ? i = { from:
|
|
72
|
+
return this.query.charCodeAt(0) == e && (this.query.length == 1 ? i = { from: t, to: n } : this.matches.push(1, t)), i && this.test && !this.test(i.from, i.to, this.buffer, this.bufferStart) && (i = null), i;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
typeof Symbol < "u" && (
|
|
75
|
+
typeof Symbol < "u" && (C.prototype[Symbol.iterator] = function() {
|
|
76
76
|
return this;
|
|
77
77
|
});
|
|
78
|
-
const
|
|
79
|
-
class
|
|
78
|
+
const ee = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }, _ = "gm" + (/x/.unicode == null ? "" : "u");
|
|
79
|
+
class te {
|
|
80
80
|
/**
|
|
81
81
|
Create a cursor that will search the given range in the given
|
|
82
82
|
document. `query` should be the raw pattern (as you'd pass it to
|
|
83
83
|
`new RegExp`).
|
|
84
84
|
*/
|
|
85
|
-
constructor(e,
|
|
86
|
-
if (this.text = e, this.to = s, this.curLine = "", this.done = !1, this.value =
|
|
87
|
-
return new
|
|
88
|
-
this.re = new RegExp(
|
|
85
|
+
constructor(e, t, n, i = 0, s = e.length) {
|
|
86
|
+
if (this.text = e, this.to = s, this.curLine = "", this.done = !1, this.value = ee, /\\[sWDnr]|\n|\r|\[\^/.test(t))
|
|
87
|
+
return new re(e, t, n, i, s);
|
|
88
|
+
this.re = new RegExp(t, _ + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.iter = e.iter();
|
|
89
89
|
let l = e.lineAt(i);
|
|
90
|
-
this.curLineStart = l.from, this.matchPos =
|
|
90
|
+
this.curLineStart = l.from, this.matchPos = D(e, i), this.getLine(this.curLineStart);
|
|
91
91
|
}
|
|
92
92
|
getLine(e) {
|
|
93
93
|
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());
|
|
@@ -101,11 +101,11 @@ class le {
|
|
|
101
101
|
next() {
|
|
102
102
|
for (let e = this.matchPos - this.curLineStart; ; ) {
|
|
103
103
|
this.re.lastIndex = e;
|
|
104
|
-
let
|
|
105
|
-
if (
|
|
106
|
-
let
|
|
107
|
-
if (this.matchPos =
|
|
108
|
-
return this.value = { from:
|
|
104
|
+
let t = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
105
|
+
if (t) {
|
|
106
|
+
let n = this.curLineStart + t.index, i = n + t[0].length;
|
|
107
|
+
if (this.matchPos = D(this.text, i + (n == i ? 1 : 0)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < i || n > this.value.to) && (!this.test || this.test(n, i, t)))
|
|
108
|
+
return this.value = { from: n, to: i, match: t }, this;
|
|
109
109
|
e = this.matchPos - this.curLineStart;
|
|
110
110
|
} else if (this.curLineStart + this.curLine.length < this.to)
|
|
111
111
|
this.nextLine(), e = 0;
|
|
@@ -114,29 +114,29 @@ class le {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
const
|
|
118
|
-
class
|
|
119
|
-
constructor(e,
|
|
120
|
-
this.from = e, this.text =
|
|
117
|
+
const T = /* @__PURE__ */ new WeakMap();
|
|
118
|
+
class v {
|
|
119
|
+
constructor(e, t) {
|
|
120
|
+
this.from = e, this.text = t;
|
|
121
121
|
}
|
|
122
122
|
get to() {
|
|
123
123
|
return this.from + this.text.length;
|
|
124
124
|
}
|
|
125
|
-
static get(e,
|
|
126
|
-
let i =
|
|
127
|
-
if (!i || i.from >=
|
|
128
|
-
let
|
|
129
|
-
return
|
|
125
|
+
static get(e, t, n) {
|
|
126
|
+
let i = T.get(e);
|
|
127
|
+
if (!i || i.from >= n || i.to <= t) {
|
|
128
|
+
let c = new v(t, e.sliceString(t, n));
|
|
129
|
+
return T.set(e, c), c;
|
|
130
130
|
}
|
|
131
|
-
if (i.from ==
|
|
131
|
+
if (i.from == t && i.to == n)
|
|
132
132
|
return i;
|
|
133
133
|
let { text: s, from: l } = i;
|
|
134
|
-
return l >
|
|
134
|
+
return l > t && (s = e.sliceString(t, l) + s, l = t), i.to < n && (s += e.sliceString(i.to, n)), T.set(e, new v(l, s)), new v(t, s.slice(t - l, n - l));
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
class
|
|
138
|
-
constructor(e,
|
|
139
|
-
this.text = e, this.to = s, this.done = !1, this.value =
|
|
137
|
+
class re {
|
|
138
|
+
constructor(e, t, n, i, s) {
|
|
139
|
+
this.text = e, this.to = s, this.done = !1, this.value = ee, this.matchPos = D(e, i), this.re = new RegExp(t, _ + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.flat = v.get(e, i, this.chunkEnd(
|
|
140
140
|
i + 5e3
|
|
141
141
|
/* Chunk.Base */
|
|
142
142
|
));
|
|
@@ -146,642 +146,609 @@ class oe {
|
|
|
146
146
|
}
|
|
147
147
|
next() {
|
|
148
148
|
for (; ; ) {
|
|
149
|
-
let e = this.re.lastIndex = this.matchPos - this.flat.from,
|
|
150
|
-
if (
|
|
151
|
-
let
|
|
152
|
-
if ((this.flat.to >= this.to ||
|
|
153
|
-
return this.value = { from:
|
|
149
|
+
let e = this.re.lastIndex = this.matchPos - this.flat.from, t = this.re.exec(this.flat.text);
|
|
150
|
+
if (t && !t[0] && t.index == e && (this.re.lastIndex = e + 1, t = this.re.exec(this.flat.text)), t) {
|
|
151
|
+
let n = this.flat.from + t.index, i = n + t[0].length;
|
|
152
|
+
if ((this.flat.to >= this.to || t.index + t[0].length <= this.flat.text.length - 10) && (!this.test || this.test(n, i, t)))
|
|
153
|
+
return this.value = { from: n, to: i, match: t }, this.matchPos = D(this.text, i + (n == i ? 1 : 0)), this;
|
|
154
154
|
}
|
|
155
155
|
if (this.flat.to == this.to)
|
|
156
156
|
return this.done = !0, this;
|
|
157
|
-
this.flat =
|
|
157
|
+
this.flat = v.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
typeof Symbol < "u" && (
|
|
161
|
+
typeof Symbol < "u" && (te.prototype[Symbol.iterator] = re.prototype[Symbol.iterator] = function() {
|
|
162
162
|
return this;
|
|
163
163
|
});
|
|
164
|
-
function
|
|
164
|
+
function Me(r) {
|
|
165
165
|
try {
|
|
166
|
-
return new RegExp(
|
|
166
|
+
return new RegExp(r, _), !0;
|
|
167
167
|
} catch {
|
|
168
168
|
return !1;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
if (e >=
|
|
171
|
+
function D(r, e) {
|
|
172
|
+
if (e >= r.length)
|
|
173
173
|
return e;
|
|
174
|
-
let
|
|
175
|
-
for (; e <
|
|
174
|
+
let t = r.lineAt(e), n;
|
|
175
|
+
for (; e < t.to && (n = t.text.charCodeAt(e - t.from)) >= 56320 && n < 57344; )
|
|
176
176
|
e++;
|
|
177
177
|
return e;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
let e = String(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
onclick: () => {
|
|
191
|
-
t.dispatch({ effects: L.of(!1) }), t.focus();
|
|
192
|
-
},
|
|
193
|
-
"aria-label": t.state.phrase("close"),
|
|
194
|
-
type: "button"
|
|
195
|
-
}, ["×"]));
|
|
196
|
-
function i() {
|
|
197
|
-
let s = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);
|
|
198
|
-
if (!s)
|
|
179
|
+
const ye = (r) => {
|
|
180
|
+
let { state: e } = r, t = String(e.doc.lineAt(r.state.selection.main.head).number), { close: n, result: i } = he(r, {
|
|
181
|
+
label: e.phrase("Go to line"),
|
|
182
|
+
input: { type: "text", name: "line", value: t },
|
|
183
|
+
focus: !0,
|
|
184
|
+
submitLabel: e.phrase("go")
|
|
185
|
+
});
|
|
186
|
+
return i.then((s) => {
|
|
187
|
+
let l = s && /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);
|
|
188
|
+
if (!l) {
|
|
189
|
+
r.dispatch({ effects: n });
|
|
199
190
|
return;
|
|
200
|
-
let { state: l } = t, o = l.doc.lineAt(l.selection.main.head), [, c, a, u, m] = s, E = u ? +u.slice(1) : 0, k = a ? +a : o.number;
|
|
201
|
-
if (a && m) {
|
|
202
|
-
let O = k / 100;
|
|
203
|
-
c && (O = O * (c == "-" ? -1 : 1) + o.number / l.doc.lines), k = Math.round(l.doc.lines * O);
|
|
204
|
-
} else a && c && (k = k * (c == "-" ? -1 : 1) + o.number);
|
|
205
|
-
let G = l.doc.line(Math.max(1, Math.min(l.doc.lines, k))), j = g.cursor(G.from + Math.max(0, Math.min(E, G.length)));
|
|
206
|
-
t.dispatch({
|
|
207
|
-
effects: [L.of(!1), x.scrollIntoView(j.from, { y: "center" })],
|
|
208
|
-
selection: j
|
|
209
|
-
}), t.focus();
|
|
210
|
-
}
|
|
211
|
-
return { dom: r };
|
|
212
|
-
}
|
|
213
|
-
const L = /* @__PURE__ */ A.define(), U = /* @__PURE__ */ te.define({
|
|
214
|
-
create() {
|
|
215
|
-
return !0;
|
|
216
|
-
},
|
|
217
|
-
update(t, e) {
|
|
218
|
-
for (let n of e.effects)
|
|
219
|
-
n.is(L) && (t = n.value);
|
|
220
|
-
return t;
|
|
221
|
-
},
|
|
222
|
-
provide: (t) => ee.from(t, (e) => e ? _ : null)
|
|
223
|
-
}), ve = (t) => {
|
|
224
|
-
let e = R(t, _);
|
|
225
|
-
if (!e) {
|
|
226
|
-
let n = [L.of(!0)];
|
|
227
|
-
t.state.field(U, !1) == null && n.push(A.appendConfig.of([U, Ce])), t.dispatch({ effects: n }), e = R(t, _);
|
|
228
|
-
}
|
|
229
|
-
return e && e.dom.querySelector("input").select(), !0;
|
|
230
|
-
}, Ce = /* @__PURE__ */ x.baseTheme({
|
|
231
|
-
".cm-panel.cm-gotoLine": {
|
|
232
|
-
padding: "2px 6px 4px",
|
|
233
|
-
position: "relative",
|
|
234
|
-
"& label": { fontSize: "80%" },
|
|
235
|
-
"& [name=close]": {
|
|
236
|
-
position: "absolute",
|
|
237
|
-
top: "0",
|
|
238
|
-
bottom: "0",
|
|
239
|
-
right: "4px",
|
|
240
|
-
backgroundColor: "inherit",
|
|
241
|
-
border: "none",
|
|
242
|
-
font: "inherit",
|
|
243
|
-
padding: "0"
|
|
244
191
|
}
|
|
245
|
-
|
|
246
|
-
|
|
192
|
+
let c = e.doc.lineAt(e.selection.main.head), [, o, h, a, d] = l, A = a ? +a.slice(1) : 0, k = h ? +h : c.number;
|
|
193
|
+
if (h && d) {
|
|
194
|
+
let I = k / 100;
|
|
195
|
+
o && (I = I * (o == "-" ? -1 : 1) + c.number / e.doc.lines), k = Math.round(e.doc.lines * I);
|
|
196
|
+
} else h && o && (k = k * (o == "-" ? -1 : 1) + c.number);
|
|
197
|
+
let V = e.doc.line(Math.max(1, Math.min(e.doc.lines, k))), H = p.cursor(V.from + Math.max(0, Math.min(A, V.length)));
|
|
198
|
+
r.dispatch({
|
|
199
|
+
effects: [n, S.scrollIntoView(H.from, { y: "center" })],
|
|
200
|
+
selection: H
|
|
201
|
+
});
|
|
202
|
+
}), !0;
|
|
203
|
+
}, ve = {
|
|
247
204
|
highlightWordAroundCursor: !1,
|
|
248
205
|
minSelectionLength: 1,
|
|
249
206
|
maxMatches: 100,
|
|
250
207
|
wholeWords: !1
|
|
251
|
-
},
|
|
252
|
-
combine(
|
|
253
|
-
return
|
|
254
|
-
highlightWordAroundCursor: (e,
|
|
208
|
+
}, Ce = /* @__PURE__ */ X.define({
|
|
209
|
+
combine(r) {
|
|
210
|
+
return Y(r, ve, {
|
|
211
|
+
highlightWordAroundCursor: (e, t) => e || t,
|
|
255
212
|
minSelectionLength: Math.min,
|
|
256
213
|
maxMatches: Math.min
|
|
257
214
|
});
|
|
258
215
|
}
|
|
259
216
|
});
|
|
260
|
-
function
|
|
261
|
-
return [
|
|
217
|
+
function Je(r) {
|
|
218
|
+
return [Ae, We];
|
|
262
219
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
265
|
-
return (
|
|
220
|
+
const be = /* @__PURE__ */ f.mark({ class: "cm-selectionMatch" }), ke = /* @__PURE__ */ f.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
221
|
+
function G(r, e, t, n) {
|
|
222
|
+
return (t == 0 || r(e.sliceDoc(t - 1, t)) != g.Word) && (n == e.doc.length || r(e.sliceDoc(n, n + 1)) != g.Word);
|
|
266
223
|
}
|
|
267
|
-
function
|
|
268
|
-
return
|
|
224
|
+
function Le(r, e, t, n) {
|
|
225
|
+
return r(e.sliceDoc(t, t + 1)) == g.Word && r(e.sliceDoc(n - 1, n)) == g.Word;
|
|
269
226
|
}
|
|
270
|
-
const
|
|
271
|
-
constructor(
|
|
272
|
-
this.decorations = this.getDeco(
|
|
273
|
-
}
|
|
274
|
-
update(
|
|
275
|
-
(
|
|
276
|
-
}
|
|
277
|
-
getDeco(
|
|
278
|
-
let e =
|
|
279
|
-
if (
|
|
280
|
-
return
|
|
281
|
-
let i =
|
|
227
|
+
const We = /* @__PURE__ */ U.fromClass(class {
|
|
228
|
+
constructor(r) {
|
|
229
|
+
this.decorations = this.getDeco(r);
|
|
230
|
+
}
|
|
231
|
+
update(r) {
|
|
232
|
+
(r.selectionSet || r.docChanged || r.viewportChanged) && (this.decorations = this.getDeco(r.view));
|
|
233
|
+
}
|
|
234
|
+
getDeco(r) {
|
|
235
|
+
let e = r.state.facet(Ce), { state: t } = r, n = t.selection;
|
|
236
|
+
if (n.ranges.length > 1)
|
|
237
|
+
return f.none;
|
|
238
|
+
let i = n.main, s, l = null;
|
|
282
239
|
if (i.empty) {
|
|
283
240
|
if (!e.highlightWordAroundCursor)
|
|
284
|
-
return
|
|
285
|
-
let
|
|
286
|
-
if (!
|
|
287
|
-
return
|
|
288
|
-
l =
|
|
241
|
+
return f.none;
|
|
242
|
+
let o = t.wordAt(i.head);
|
|
243
|
+
if (!o)
|
|
244
|
+
return f.none;
|
|
245
|
+
l = t.charCategorizer(i.head), s = t.sliceDoc(o.from, o.to);
|
|
289
246
|
} else {
|
|
290
|
-
let
|
|
291
|
-
if (
|
|
292
|
-
return
|
|
247
|
+
let o = i.to - i.from;
|
|
248
|
+
if (o < e.minSelectionLength || o > 200)
|
|
249
|
+
return f.none;
|
|
293
250
|
if (e.wholeWords) {
|
|
294
|
-
if (s =
|
|
295
|
-
return
|
|
296
|
-
} else if (s =
|
|
297
|
-
return
|
|
251
|
+
if (s = t.sliceDoc(i.from, i.to), l = t.charCategorizer(i.head), !(G(l, t, i.from, i.to) && Le(l, t, i.from, i.to)))
|
|
252
|
+
return f.none;
|
|
253
|
+
} else if (s = t.sliceDoc(i.from, i.to), !s)
|
|
254
|
+
return f.none;
|
|
298
255
|
}
|
|
299
|
-
let
|
|
300
|
-
for (let
|
|
301
|
-
let
|
|
302
|
-
for (; !
|
|
303
|
-
let { from:
|
|
304
|
-
if ((!l ||
|
|
305
|
-
return
|
|
256
|
+
let c = [];
|
|
257
|
+
for (let o of r.visibleRanges) {
|
|
258
|
+
let h = new C(t.doc, s, o.from, o.to);
|
|
259
|
+
for (; !h.next().done; ) {
|
|
260
|
+
let { from: a, to: d } = h.value;
|
|
261
|
+
if ((!l || G(l, t, a, d)) && (i.empty && a <= i.from && d >= i.to ? c.push(ke.range(a, d)) : (a >= i.to || d <= i.from) && c.push(be.range(a, d)), c.length > e.maxMatches))
|
|
262
|
+
return f.none;
|
|
306
263
|
}
|
|
307
264
|
}
|
|
308
|
-
return
|
|
265
|
+
return f.set(c);
|
|
309
266
|
}
|
|
310
267
|
}, {
|
|
311
|
-
decorations: (
|
|
312
|
-
}),
|
|
268
|
+
decorations: (r) => r.decorations
|
|
269
|
+
}), Ae = /* @__PURE__ */ S.baseTheme({
|
|
313
270
|
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
314
271
|
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
315
|
-
}),
|
|
316
|
-
let { selection:
|
|
317
|
-
return
|
|
272
|
+
}), Ee = ({ state: r, dispatch: e }) => {
|
|
273
|
+
let { selection: t } = r, n = p.create(t.ranges.map((i) => r.wordAt(i.head) || p.cursor(i.head)), t.mainIndex);
|
|
274
|
+
return n.eq(t) ? !1 : (e(r.update({ selection: n })), !0);
|
|
318
275
|
};
|
|
319
|
-
function
|
|
320
|
-
let { main:
|
|
321
|
-
for (let l = !1,
|
|
322
|
-
if (
|
|
276
|
+
function Fe(r, e) {
|
|
277
|
+
let { main: t, ranges: n } = r.selection, i = r.wordAt(t.head), s = i && i.from == t.from && i.to == t.to;
|
|
278
|
+
for (let l = !1, c = new C(r.doc, e, n[n.length - 1].to); ; )
|
|
279
|
+
if (c.next(), c.done) {
|
|
323
280
|
if (l)
|
|
324
281
|
return null;
|
|
325
|
-
|
|
282
|
+
c = new C(r.doc, e, 0, Math.max(0, n[n.length - 1].from - 1)), l = !0;
|
|
326
283
|
} else {
|
|
327
|
-
if (l &&
|
|
284
|
+
if (l && n.some((o) => o.from == c.value.from))
|
|
328
285
|
continue;
|
|
329
286
|
if (s) {
|
|
330
|
-
let
|
|
331
|
-
if (!
|
|
287
|
+
let o = r.wordAt(c.value.from);
|
|
288
|
+
if (!o || o.from != c.value.from || o.to != c.value.to)
|
|
332
289
|
continue;
|
|
333
290
|
}
|
|
334
|
-
return
|
|
291
|
+
return c.value;
|
|
335
292
|
}
|
|
336
293
|
}
|
|
337
|
-
const
|
|
338
|
-
let { ranges:
|
|
339
|
-
if (
|
|
340
|
-
return
|
|
341
|
-
let
|
|
342
|
-
if (
|
|
294
|
+
const De = ({ state: r, dispatch: e }) => {
|
|
295
|
+
let { ranges: t } = r.selection;
|
|
296
|
+
if (t.some((s) => s.from === s.to))
|
|
297
|
+
return Ee({ state: r, dispatch: e });
|
|
298
|
+
let n = r.sliceDoc(t[0].from, t[0].to);
|
|
299
|
+
if (r.selection.ranges.some((s) => r.sliceDoc(s.from, s.to) != n))
|
|
343
300
|
return !1;
|
|
344
|
-
let i =
|
|
345
|
-
return i ? (e(
|
|
346
|
-
selection:
|
|
347
|
-
effects:
|
|
301
|
+
let i = Fe(r, n);
|
|
302
|
+
return i ? (e(r.update({
|
|
303
|
+
selection: r.selection.addRange(p.range(i.from, i.to), !1),
|
|
304
|
+
effects: S.scrollIntoView(i.to)
|
|
348
305
|
})), !0) : !1;
|
|
349
|
-
},
|
|
350
|
-
combine(
|
|
351
|
-
return
|
|
306
|
+
}, b = /* @__PURE__ */ X.define({
|
|
307
|
+
combine(r) {
|
|
308
|
+
return Y(r, {
|
|
352
309
|
top: !1,
|
|
353
310
|
caseSensitive: !1,
|
|
354
311
|
literal: !1,
|
|
355
312
|
regexp: !1,
|
|
356
313
|
wholeWord: !1,
|
|
357
|
-
createPanel: (e) => new
|
|
358
|
-
scrollToMatch: (e) =>
|
|
314
|
+
createPanel: (e) => new Ne(e),
|
|
315
|
+
scrollToMatch: (e) => S.scrollIntoView(e)
|
|
359
316
|
});
|
|
360
317
|
}
|
|
361
318
|
});
|
|
362
|
-
class
|
|
319
|
+
class ne {
|
|
363
320
|
/**
|
|
364
321
|
Create a query object.
|
|
365
322
|
*/
|
|
366
323
|
constructor(e) {
|
|
367
|
-
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 ||
|
|
324
|
+
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 || Me(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord, this.test = e.test;
|
|
368
325
|
}
|
|
369
326
|
/**
|
|
370
327
|
@internal
|
|
371
328
|
*/
|
|
372
329
|
unquote(e) {
|
|
373
|
-
return this.literal ? e : e.replace(/\\([nrt\\])/g, (
|
|
374
|
-
` :
|
|
330
|
+
return this.literal ? e : e.replace(/\\([nrt\\])/g, (t, n) => n == "n" ? `
|
|
331
|
+
` : n == "r" ? "\r" : n == "t" ? " " : "\\");
|
|
375
332
|
}
|
|
376
333
|
/**
|
|
377
334
|
Compare this query to another query.
|
|
378
335
|
*/
|
|
379
336
|
eq(e) {
|
|
380
|
-
return this.search == e.search && this.replace == e.replace && this.caseSensitive == e.caseSensitive && this.regexp == e.regexp && this.wholeWord == e.wholeWord;
|
|
337
|
+
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;
|
|
381
338
|
}
|
|
382
339
|
/**
|
|
383
340
|
@internal
|
|
384
341
|
*/
|
|
385
342
|
create() {
|
|
386
|
-
return this.regexp ? new
|
|
343
|
+
return this.regexp ? new Te(this) : new we(this);
|
|
387
344
|
}
|
|
388
345
|
/**
|
|
389
346
|
Get a search cursor for this query, searching through the given
|
|
390
347
|
range in the given state.
|
|
391
348
|
*/
|
|
392
|
-
getCursor(e,
|
|
393
|
-
let i = e.doc ? e :
|
|
394
|
-
return
|
|
349
|
+
getCursor(e, t = 0, n) {
|
|
350
|
+
let i = e.doc ? e : pe.create({ doc: e });
|
|
351
|
+
return n == null && (n = i.doc.length), this.regexp ? y(this, i, t, n) : M(this, i, t, n);
|
|
395
352
|
}
|
|
396
353
|
}
|
|
397
|
-
class
|
|
354
|
+
class ie {
|
|
398
355
|
constructor(e) {
|
|
399
356
|
this.spec = e;
|
|
400
357
|
}
|
|
401
358
|
}
|
|
402
|
-
function
|
|
403
|
-
return
|
|
359
|
+
function Re(r, e, t) {
|
|
360
|
+
return (n, i, s, l) => {
|
|
361
|
+
if (t && !t(n, i, s, l))
|
|
362
|
+
return !1;
|
|
363
|
+
let c = n >= l && i <= l + s.length ? s.slice(n - l, i - l) : e.doc.sliceString(n, i);
|
|
364
|
+
return r(c, e, n, i);
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function M(r, e, t, n) {
|
|
368
|
+
let i;
|
|
369
|
+
return r.wholeWord && (i = qe(e.doc, e.charCategorizer(e.selection.main.head))), r.test && (i = Re(r.test, e, i)), new C(e.doc, r.unquoted, t, n, r.caseSensitive ? void 0 : (s) => s.toLowerCase(), i);
|
|
404
370
|
}
|
|
405
|
-
function
|
|
406
|
-
return (
|
|
371
|
+
function qe(r, e) {
|
|
372
|
+
return (t, n, i, s) => ((s > t || s + i.length < n) && (s = Math.max(0, t - 2), i = r.sliceString(s, Math.min(r.length, n + 2))), (e(R(i, t - s)) != g.Word || e(q(i, t - s)) != g.Word) && (e(q(i, n - s)) != g.Word || e(R(i, n - s)) != g.Word));
|
|
407
373
|
}
|
|
408
|
-
class
|
|
374
|
+
class we extends ie {
|
|
409
375
|
constructor(e) {
|
|
410
376
|
super(e);
|
|
411
377
|
}
|
|
412
|
-
nextMatch(e,
|
|
413
|
-
let i =
|
|
378
|
+
nextMatch(e, t, n) {
|
|
379
|
+
let i = M(this.spec, e, n, e.doc.length).nextOverlapping();
|
|
414
380
|
if (i.done) {
|
|
415
|
-
let s = Math.min(e.doc.length,
|
|
416
|
-
i =
|
|
381
|
+
let s = Math.min(e.doc.length, t + this.spec.unquoted.length);
|
|
382
|
+
i = M(this.spec, e, 0, s).nextOverlapping();
|
|
417
383
|
}
|
|
418
|
-
return i.done || i.value.from ==
|
|
384
|
+
return i.done || i.value.from == t && i.value.to == n ? null : i.value;
|
|
419
385
|
}
|
|
420
386
|
// Searching in reverse is, rather than implementing an inverted search
|
|
421
387
|
// cursor, done by scanning chunk after chunk forward.
|
|
422
|
-
prevMatchInRange(e,
|
|
423
|
-
for (let i =
|
|
424
|
-
let s = Math.max(
|
|
388
|
+
prevMatchInRange(e, t, n) {
|
|
389
|
+
for (let i = n; ; ) {
|
|
390
|
+
let s = Math.max(t, i - 1e4 - this.spec.unquoted.length), l = M(this.spec, e, s, i), c = null;
|
|
425
391
|
for (; !l.nextOverlapping().done; )
|
|
426
|
-
|
|
427
|
-
if (
|
|
428
|
-
return
|
|
429
|
-
if (s ==
|
|
392
|
+
c = l.value;
|
|
393
|
+
if (c)
|
|
394
|
+
return c;
|
|
395
|
+
if (s == t)
|
|
430
396
|
return null;
|
|
431
397
|
i -= 1e4;
|
|
432
398
|
}
|
|
433
399
|
}
|
|
434
|
-
prevMatch(e,
|
|
435
|
-
let i = this.prevMatchInRange(e, 0,
|
|
436
|
-
return i || (i = this.prevMatchInRange(e, Math.max(0,
|
|
400
|
+
prevMatch(e, t, n) {
|
|
401
|
+
let i = this.prevMatchInRange(e, 0, t);
|
|
402
|
+
return i || (i = this.prevMatchInRange(e, Math.max(0, n - this.spec.unquoted.length), e.doc.length)), i && (i.from != t || i.to != n) ? i : null;
|
|
437
403
|
}
|
|
438
404
|
getReplacement(e) {
|
|
439
405
|
return this.spec.unquote(this.spec.replace);
|
|
440
406
|
}
|
|
441
|
-
matchAll(e,
|
|
442
|
-
let
|
|
443
|
-
for (; !
|
|
444
|
-
if (i.length >=
|
|
407
|
+
matchAll(e, t) {
|
|
408
|
+
let n = M(this.spec, e, 0, e.doc.length), i = [];
|
|
409
|
+
for (; !n.next().done; ) {
|
|
410
|
+
if (i.length >= t)
|
|
445
411
|
return null;
|
|
446
|
-
i.push(
|
|
412
|
+
i.push(n.value);
|
|
447
413
|
}
|
|
448
414
|
return i;
|
|
449
415
|
}
|
|
450
|
-
highlight(e,
|
|
451
|
-
let s =
|
|
416
|
+
highlight(e, t, n, i) {
|
|
417
|
+
let s = M(this.spec, e, Math.max(0, t - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length));
|
|
452
418
|
for (; !s.next().done; )
|
|
453
419
|
i(s.value.from, s.value.to);
|
|
454
420
|
}
|
|
455
421
|
}
|
|
456
|
-
function
|
|
457
|
-
return
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
422
|
+
function Pe(r, e, t) {
|
|
423
|
+
return (n, i, s) => (!t || t(n, i, s)) && r(s[0], e, n, i);
|
|
424
|
+
}
|
|
425
|
+
function y(r, e, t, n) {
|
|
426
|
+
let i;
|
|
427
|
+
return r.wholeWord && (i = Ie(e.charCategorizer(e.selection.main.head))), r.test && (i = Pe(r.test, e, i)), new te(e.doc, r.search, { ignoreCase: !r.caseSensitive, test: i }, t, n);
|
|
461
428
|
}
|
|
462
|
-
function
|
|
463
|
-
return
|
|
429
|
+
function R(r, e) {
|
|
430
|
+
return r.slice(Z(r, e, !1), e);
|
|
464
431
|
}
|
|
465
|
-
function
|
|
466
|
-
return
|
|
432
|
+
function q(r, e) {
|
|
433
|
+
return r.slice(e, Z(r, e));
|
|
467
434
|
}
|
|
468
|
-
function
|
|
469
|
-
return (e,
|
|
435
|
+
function Ie(r) {
|
|
436
|
+
return (e, t, n) => !n[0].length || (r(R(n.input, n.index)) != g.Word || r(q(n.input, n.index)) != g.Word) && (r(q(n.input, n.index + n[0].length)) != g.Word || r(R(n.input, n.index + n[0].length)) != g.Word);
|
|
470
437
|
}
|
|
471
|
-
class
|
|
472
|
-
nextMatch(e,
|
|
473
|
-
let i =
|
|
474
|
-
return i.done && (i =
|
|
438
|
+
class Te extends ie {
|
|
439
|
+
nextMatch(e, t, n) {
|
|
440
|
+
let i = y(this.spec, e, n, e.doc.length).next();
|
|
441
|
+
return i.done && (i = y(this.spec, e, 0, t).next()), i.done ? null : i.value;
|
|
475
442
|
}
|
|
476
|
-
prevMatchInRange(e,
|
|
443
|
+
prevMatchInRange(e, t, n) {
|
|
477
444
|
for (let i = 1; ; i++) {
|
|
478
445
|
let s = Math.max(
|
|
479
|
-
|
|
480
|
-
|
|
446
|
+
t,
|
|
447
|
+
n - i * 1e4
|
|
481
448
|
/* FindPrev.ChunkSize */
|
|
482
|
-
), l =
|
|
449
|
+
), l = y(this.spec, e, s, n), c = null;
|
|
483
450
|
for (; !l.next().done; )
|
|
484
|
-
|
|
485
|
-
if (
|
|
486
|
-
return
|
|
487
|
-
if (s ==
|
|
451
|
+
c = l.value;
|
|
452
|
+
if (c && (s == t || c.from > s + 10))
|
|
453
|
+
return c;
|
|
454
|
+
if (s == t)
|
|
488
455
|
return null;
|
|
489
456
|
}
|
|
490
457
|
}
|
|
491
|
-
prevMatch(e,
|
|
492
|
-
return this.prevMatchInRange(e, 0,
|
|
458
|
+
prevMatch(e, t, n) {
|
|
459
|
+
return this.prevMatchInRange(e, 0, t) || this.prevMatchInRange(e, n, e.doc.length);
|
|
493
460
|
}
|
|
494
461
|
getReplacement(e) {
|
|
495
|
-
return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (
|
|
496
|
-
if (
|
|
462
|
+
return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (t, n) => {
|
|
463
|
+
if (n == "&")
|
|
497
464
|
return e.match[0];
|
|
498
|
-
if (
|
|
465
|
+
if (n == "$")
|
|
499
466
|
return "$";
|
|
500
|
-
for (let i =
|
|
501
|
-
let s = +
|
|
467
|
+
for (let i = n.length; i > 0; i--) {
|
|
468
|
+
let s = +n.slice(0, i);
|
|
502
469
|
if (s > 0 && s < e.match.length)
|
|
503
|
-
return e.match[s] +
|
|
470
|
+
return e.match[s] + n.slice(i);
|
|
504
471
|
}
|
|
505
|
-
return
|
|
472
|
+
return t;
|
|
506
473
|
});
|
|
507
474
|
}
|
|
508
|
-
matchAll(e,
|
|
509
|
-
let
|
|
510
|
-
for (; !
|
|
511
|
-
if (i.length >=
|
|
475
|
+
matchAll(e, t) {
|
|
476
|
+
let n = y(this.spec, e, 0, e.doc.length), i = [];
|
|
477
|
+
for (; !n.next().done; ) {
|
|
478
|
+
if (i.length >= t)
|
|
512
479
|
return null;
|
|
513
|
-
i.push(
|
|
480
|
+
i.push(n.value);
|
|
514
481
|
}
|
|
515
482
|
return i;
|
|
516
483
|
}
|
|
517
|
-
highlight(e,
|
|
518
|
-
let s =
|
|
484
|
+
highlight(e, t, n, i) {
|
|
485
|
+
let s = y(this.spec, e, Math.max(
|
|
519
486
|
0,
|
|
520
|
-
|
|
487
|
+
t - 250
|
|
521
488
|
/* RegExp.HighlightMargin */
|
|
522
|
-
), Math.min(
|
|
489
|
+
), Math.min(n + 250, e.doc.length));
|
|
523
490
|
for (; !s.next().done; )
|
|
524
491
|
i(s.value.from, s.value.to);
|
|
525
492
|
}
|
|
526
493
|
}
|
|
527
|
-
const
|
|
528
|
-
create(
|
|
529
|
-
return new
|
|
494
|
+
const L = /* @__PURE__ */ Q.define(), z = /* @__PURE__ */ Q.define(), x = /* @__PURE__ */ fe.define({
|
|
495
|
+
create(r) {
|
|
496
|
+
return new O($(r).create(), null);
|
|
530
497
|
},
|
|
531
|
-
update(
|
|
532
|
-
for (let
|
|
533
|
-
|
|
534
|
-
return
|
|
498
|
+
update(r, e) {
|
|
499
|
+
for (let t of e.effects)
|
|
500
|
+
t.is(L) ? r = new O(t.value.create(), r.panel) : t.is(z) && (r = new O(r.query, t.value ? B : null));
|
|
501
|
+
return r;
|
|
535
502
|
},
|
|
536
|
-
provide: (
|
|
503
|
+
provide: (r) => ae.from(r, (e) => e.panel)
|
|
537
504
|
});
|
|
538
|
-
class
|
|
539
|
-
constructor(e,
|
|
540
|
-
this.query = e, this.panel =
|
|
505
|
+
class O {
|
|
506
|
+
constructor(e, t) {
|
|
507
|
+
this.query = e, this.panel = t;
|
|
541
508
|
}
|
|
542
509
|
}
|
|
543
|
-
const Oe = /* @__PURE__ */
|
|
544
|
-
constructor(
|
|
545
|
-
this.view =
|
|
546
|
-
}
|
|
547
|
-
update(
|
|
548
|
-
let e =
|
|
549
|
-
(e !=
|
|
550
|
-
}
|
|
551
|
-
highlight({ query:
|
|
552
|
-
if (!e || !
|
|
553
|
-
return
|
|
554
|
-
let { view:
|
|
555
|
-
for (let i = 0, s =
|
|
556
|
-
let { from:
|
|
557
|
-
for (; i < l - 1 &&
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
let
|
|
561
|
-
|
|
510
|
+
const Oe = /* @__PURE__ */ f.mark({ class: "cm-searchMatch" }), $e = /* @__PURE__ */ f.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), Qe = /* @__PURE__ */ U.fromClass(class {
|
|
511
|
+
constructor(r) {
|
|
512
|
+
this.view = r, this.decorations = this.highlight(r.state.field(x));
|
|
513
|
+
}
|
|
514
|
+
update(r) {
|
|
515
|
+
let e = r.state.field(x);
|
|
516
|
+
(e != r.startState.field(x) || r.docChanged || r.selectionSet || r.viewportChanged) && (this.decorations = this.highlight(e));
|
|
517
|
+
}
|
|
518
|
+
highlight({ query: r, panel: e }) {
|
|
519
|
+
if (!e || !r.spec.valid)
|
|
520
|
+
return f.none;
|
|
521
|
+
let { view: t } = this, n = new xe();
|
|
522
|
+
for (let i = 0, s = t.visibleRanges, l = s.length; i < l; i++) {
|
|
523
|
+
let { from: c, to: o } = s[i];
|
|
524
|
+
for (; i < l - 1 && o > s[i + 1].from - 500; )
|
|
525
|
+
o = s[++i].to;
|
|
526
|
+
r.highlight(t.state, c, o, (h, a) => {
|
|
527
|
+
let d = t.state.selection.ranges.some((A) => A.from == h && A.to == a);
|
|
528
|
+
n.add(h, a, d ? $e : Oe);
|
|
562
529
|
});
|
|
563
530
|
}
|
|
564
|
-
return
|
|
531
|
+
return n.finish();
|
|
565
532
|
}
|
|
566
533
|
}, {
|
|
567
|
-
decorations: (
|
|
534
|
+
decorations: (r) => r.decorations
|
|
568
535
|
});
|
|
569
|
-
function
|
|
536
|
+
function W(r) {
|
|
570
537
|
return (e) => {
|
|
571
|
-
let
|
|
572
|
-
return
|
|
538
|
+
let t = e.state.field(x, !1);
|
|
539
|
+
return t && t.query.spec.valid ? r(e, t) : ce(e);
|
|
573
540
|
};
|
|
574
541
|
}
|
|
575
|
-
const
|
|
576
|
-
let { to:
|
|
577
|
-
if (!
|
|
542
|
+
const w = /* @__PURE__ */ W((r, { query: e }) => {
|
|
543
|
+
let { to: t } = r.state.selection.main, n = e.nextMatch(r.state, t, t);
|
|
544
|
+
if (!n)
|
|
578
545
|
return !1;
|
|
579
|
-
let i =
|
|
580
|
-
return
|
|
546
|
+
let i = p.single(n.from, n.to), s = r.state.facet(b);
|
|
547
|
+
return r.dispatch({
|
|
581
548
|
selection: i,
|
|
582
|
-
effects: [
|
|
549
|
+
effects: [N(r, n), s.scrollToMatch(i.main, r)],
|
|
583
550
|
userEvent: "select.search"
|
|
584
|
-
}),
|
|
585
|
-
}),
|
|
586
|
-
let { state:
|
|
551
|
+
}), le(r), !0;
|
|
552
|
+
}), P = /* @__PURE__ */ W((r, { query: e }) => {
|
|
553
|
+
let { state: t } = r, { from: n } = t.selection.main, i = e.prevMatch(t, n, n);
|
|
587
554
|
if (!i)
|
|
588
555
|
return !1;
|
|
589
|
-
let s =
|
|
590
|
-
return
|
|
556
|
+
let s = p.single(i.from, i.to), l = r.state.facet(b);
|
|
557
|
+
return r.dispatch({
|
|
591
558
|
selection: s,
|
|
592
|
-
effects: [
|
|
559
|
+
effects: [N(r, i), l.scrollToMatch(s.main, r)],
|
|
593
560
|
userEvent: "select.search"
|
|
594
|
-
}),
|
|
595
|
-
}), _e = /* @__PURE__ */
|
|
596
|
-
let
|
|
597
|
-
return !
|
|
598
|
-
selection:
|
|
561
|
+
}), le(r), !0;
|
|
562
|
+
}), _e = /* @__PURE__ */ W((r, { query: e }) => {
|
|
563
|
+
let t = e.matchAll(r.state, 1e3);
|
|
564
|
+
return !t || !t.length ? !1 : (r.dispatch({
|
|
565
|
+
selection: p.create(t.map((n) => p.range(n.from, n.to))),
|
|
599
566
|
userEvent: "select.search.matches"
|
|
600
567
|
}), !0);
|
|
601
|
-
}),
|
|
602
|
-
let
|
|
603
|
-
if (
|
|
568
|
+
}), ze = ({ state: r, dispatch: e }) => {
|
|
569
|
+
let t = r.selection;
|
|
570
|
+
if (t.ranges.length > 1 || t.main.empty)
|
|
604
571
|
return !1;
|
|
605
|
-
let { from:
|
|
606
|
-
for (let
|
|
572
|
+
let { from: n, to: i } = t.main, s = [], l = 0;
|
|
573
|
+
for (let c = new C(r.doc, r.sliceDoc(n, i)); !c.next().done; ) {
|
|
607
574
|
if (s.length > 1e3)
|
|
608
575
|
return !1;
|
|
609
|
-
|
|
576
|
+
c.value.from == n && (l = s.length), s.push(p.range(c.value.from, c.value.to));
|
|
610
577
|
}
|
|
611
|
-
return e(
|
|
612
|
-
selection:
|
|
578
|
+
return e(r.update({
|
|
579
|
+
selection: p.create(s, l),
|
|
613
580
|
userEvent: "select.search.matches"
|
|
614
581
|
})), !0;
|
|
615
|
-
},
|
|
616
|
-
let { state:
|
|
617
|
-
if (
|
|
582
|
+
}, j = /* @__PURE__ */ W((r, { query: e }) => {
|
|
583
|
+
let { state: t } = r, { from: n, to: i } = t.selection.main;
|
|
584
|
+
if (t.readOnly)
|
|
618
585
|
return !1;
|
|
619
|
-
let s = e.nextMatch(
|
|
586
|
+
let s = e.nextMatch(t, n, n);
|
|
620
587
|
if (!s)
|
|
621
588
|
return !1;
|
|
622
|
-
let l = s,
|
|
623
|
-
l.from ==
|
|
624
|
-
let
|
|
625
|
-
return l && (
|
|
626
|
-
changes:
|
|
627
|
-
selection:
|
|
628
|
-
effects:
|
|
589
|
+
let l = s, c = [], o, h, a = [];
|
|
590
|
+
l.from == n && l.to == i && (h = t.toText(e.getReplacement(l)), c.push({ from: l.from, to: l.to, insert: h }), l = e.nextMatch(t, l.from, l.to), a.push(S.announce.of(t.phrase("replaced match on line $", t.doc.lineAt(n).number) + ".")));
|
|
591
|
+
let d = r.state.changes(c);
|
|
592
|
+
return l && (o = p.single(l.from, l.to).map(d), a.push(N(r, l)), a.push(t.facet(b).scrollToMatch(o.main, r))), r.dispatch({
|
|
593
|
+
changes: d,
|
|
594
|
+
selection: o,
|
|
595
|
+
effects: a,
|
|
629
596
|
userEvent: "input.replace"
|
|
630
597
|
}), !0;
|
|
631
|
-
}),
|
|
632
|
-
if (
|
|
598
|
+
}), Be = /* @__PURE__ */ W((r, { query: e }) => {
|
|
599
|
+
if (r.state.readOnly)
|
|
633
600
|
return !1;
|
|
634
|
-
let
|
|
601
|
+
let t = e.matchAll(r.state, 1e9).map((i) => {
|
|
635
602
|
let { from: s, to: l } = i;
|
|
636
603
|
return { from: s, to: l, insert: e.getReplacement(i) };
|
|
637
604
|
});
|
|
638
|
-
if (!
|
|
605
|
+
if (!t.length)
|
|
639
606
|
return !1;
|
|
640
|
-
let
|
|
641
|
-
return
|
|
642
|
-
changes:
|
|
643
|
-
effects:
|
|
607
|
+
let n = r.state.phrase("replaced $ matches", t.length) + ".";
|
|
608
|
+
return r.dispatch({
|
|
609
|
+
changes: t,
|
|
610
|
+
effects: S.announce.of(n),
|
|
644
611
|
userEvent: "input.replace.all"
|
|
645
612
|
}), !0;
|
|
646
613
|
});
|
|
647
|
-
function
|
|
648
|
-
return
|
|
614
|
+
function B(r) {
|
|
615
|
+
return r.state.facet(b).createPanel(r);
|
|
649
616
|
}
|
|
650
|
-
function
|
|
651
|
-
var
|
|
652
|
-
let
|
|
653
|
-
if (e && !
|
|
617
|
+
function $(r, e) {
|
|
618
|
+
var t, n, i, s, l;
|
|
619
|
+
let c = r.selection.main, o = c.empty || c.to > c.from + 100 ? "" : r.sliceDoc(c.from, c.to);
|
|
620
|
+
if (e && !o)
|
|
654
621
|
return e;
|
|
655
|
-
let
|
|
656
|
-
return new
|
|
657
|
-
search: ((
|
|
658
|
-
caseSensitive: (
|
|
659
|
-
literal: (i = e?.literal) !== null && i !== void 0 ? i :
|
|
660
|
-
regexp: (s = e?.regexp) !== null && s !== void 0 ? s :
|
|
661
|
-
wholeWord: (l = e?.wholeWord) !== null && l !== void 0 ? l :
|
|
622
|
+
let h = r.facet(b);
|
|
623
|
+
return new ne({
|
|
624
|
+
search: ((t = e?.literal) !== null && t !== void 0 ? t : h.literal) ? o : o.replace(/\n/g, "\\n"),
|
|
625
|
+
caseSensitive: (n = e?.caseSensitive) !== null && n !== void 0 ? n : h.caseSensitive,
|
|
626
|
+
literal: (i = e?.literal) !== null && i !== void 0 ? i : h.literal,
|
|
627
|
+
regexp: (s = e?.regexp) !== null && s !== void 0 ? s : h.regexp,
|
|
628
|
+
wholeWord: (l = e?.wholeWord) !== null && l !== void 0 ? l : h.wholeWord
|
|
662
629
|
});
|
|
663
630
|
}
|
|
664
|
-
function
|
|
665
|
-
let e =
|
|
631
|
+
function se(r) {
|
|
632
|
+
let e = J(r, B);
|
|
666
633
|
return e && e.dom.querySelector("[main-field]");
|
|
667
634
|
}
|
|
668
|
-
function
|
|
669
|
-
let e =
|
|
670
|
-
e && e ==
|
|
635
|
+
function le(r) {
|
|
636
|
+
let e = se(r);
|
|
637
|
+
e && e == r.root.activeElement && e.select();
|
|
671
638
|
}
|
|
672
|
-
const
|
|
673
|
-
let e =
|
|
639
|
+
const ce = (r) => {
|
|
640
|
+
let e = r.state.field(x, !1);
|
|
674
641
|
if (e && e.panel) {
|
|
675
|
-
let
|
|
676
|
-
if (
|
|
677
|
-
let
|
|
678
|
-
|
|
642
|
+
let t = se(r);
|
|
643
|
+
if (t && t != r.root.activeElement) {
|
|
644
|
+
let n = $(r.state, e.query.spec);
|
|
645
|
+
n.valid && r.dispatch({ effects: L.of(n) }), t.focus(), t.select();
|
|
679
646
|
}
|
|
680
647
|
} else
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
e ?
|
|
648
|
+
r.dispatch({ effects: [
|
|
649
|
+
z.of(!0),
|
|
650
|
+
e ? L.of($(r.state, e.query.spec)) : Q.appendConfig.of(He)
|
|
684
651
|
] });
|
|
685
652
|
return !0;
|
|
686
|
-
},
|
|
687
|
-
let e =
|
|
653
|
+
}, oe = (r) => {
|
|
654
|
+
let e = r.state.field(x, !1);
|
|
688
655
|
if (!e || !e.panel)
|
|
689
656
|
return !1;
|
|
690
|
-
let
|
|
691
|
-
return
|
|
692
|
-
},
|
|
693
|
-
{ key: "Mod-f", run:
|
|
694
|
-
{ key: "F3", run:
|
|
695
|
-
{ key: "Mod-g", run:
|
|
696
|
-
{ key: "Escape", run:
|
|
697
|
-
{ key: "Mod-Shift-l", run:
|
|
698
|
-
{ key: "Mod-Alt-g", run:
|
|
699
|
-
{ key: "Mod-d", run:
|
|
657
|
+
let t = J(r, B);
|
|
658
|
+
return t && t.dom.contains(r.root.activeElement) && r.focus(), r.dispatch({ effects: z.of(!1) }), !0;
|
|
659
|
+
}, Ue = [
|
|
660
|
+
{ key: "Mod-f", run: ce, scope: "editor search-panel" },
|
|
661
|
+
{ key: "F3", run: w, shift: P, scope: "editor search-panel", preventDefault: !0 },
|
|
662
|
+
{ key: "Mod-g", run: w, shift: P, scope: "editor search-panel", preventDefault: !0 },
|
|
663
|
+
{ key: "Escape", run: oe, scope: "editor search-panel" },
|
|
664
|
+
{ key: "Mod-Shift-l", run: ze },
|
|
665
|
+
{ key: "Mod-Alt-g", run: ye },
|
|
666
|
+
{ key: "Mod-d", run: De, preventDefault: !0 }
|
|
700
667
|
];
|
|
701
|
-
class
|
|
668
|
+
class Ne {
|
|
702
669
|
constructor(e) {
|
|
703
670
|
this.view = e;
|
|
704
|
-
let
|
|
705
|
-
this.commit = this.commit.bind(this), this.searchField =
|
|
706
|
-
value:
|
|
707
|
-
placeholder:
|
|
708
|
-
"aria-label":
|
|
671
|
+
let t = this.query = e.state.field(x).query.spec;
|
|
672
|
+
this.commit = this.commit.bind(this), this.searchField = m("input", {
|
|
673
|
+
value: t.search,
|
|
674
|
+
placeholder: u(e, "Find"),
|
|
675
|
+
"aria-label": u(e, "Find"),
|
|
709
676
|
class: "cm-textfield",
|
|
710
677
|
name: "search",
|
|
711
678
|
form: "",
|
|
712
679
|
"main-field": "true",
|
|
713
680
|
onchange: this.commit,
|
|
714
681
|
onkeyup: this.commit
|
|
715
|
-
}), this.replaceField =
|
|
716
|
-
value:
|
|
717
|
-
placeholder:
|
|
718
|
-
"aria-label":
|
|
682
|
+
}), this.replaceField = m("input", {
|
|
683
|
+
value: t.replace,
|
|
684
|
+
placeholder: u(e, "Replace"),
|
|
685
|
+
"aria-label": u(e, "Replace"),
|
|
719
686
|
class: "cm-textfield",
|
|
720
687
|
name: "replace",
|
|
721
688
|
form: "",
|
|
722
689
|
onchange: this.commit,
|
|
723
690
|
onkeyup: this.commit
|
|
724
|
-
}), this.caseField =
|
|
691
|
+
}), this.caseField = m("input", {
|
|
725
692
|
type: "checkbox",
|
|
726
693
|
name: "case",
|
|
727
694
|
form: "",
|
|
728
|
-
checked:
|
|
695
|
+
checked: t.caseSensitive,
|
|
729
696
|
onchange: this.commit
|
|
730
|
-
}), this.reField =
|
|
697
|
+
}), this.reField = m("input", {
|
|
731
698
|
type: "checkbox",
|
|
732
699
|
name: "re",
|
|
733
700
|
form: "",
|
|
734
|
-
checked:
|
|
701
|
+
checked: t.regexp,
|
|
735
702
|
onchange: this.commit
|
|
736
|
-
}), this.wordField =
|
|
703
|
+
}), this.wordField = m("input", {
|
|
737
704
|
type: "checkbox",
|
|
738
705
|
name: "word",
|
|
739
706
|
form: "",
|
|
740
|
-
checked:
|
|
707
|
+
checked: t.wholeWord,
|
|
741
708
|
onchange: this.commit
|
|
742
709
|
});
|
|
743
|
-
function
|
|
744
|
-
return
|
|
710
|
+
function n(i, s, l) {
|
|
711
|
+
return m("button", { class: "cm-button", name: i, onclick: s, type: "button" }, l);
|
|
745
712
|
}
|
|
746
|
-
this.dom =
|
|
713
|
+
this.dom = m("div", { onkeydown: (i) => this.keydown(i), class: "cm-search" }, [
|
|
747
714
|
this.searchField,
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
715
|
+
n("next", () => w(e), [u(e, "next")]),
|
|
716
|
+
n("prev", () => P(e), [u(e, "previous")]),
|
|
717
|
+
n("select", () => _e(e), [u(e, "all")]),
|
|
718
|
+
m("label", null, [this.caseField, u(e, "match case")]),
|
|
719
|
+
m("label", null, [this.reField, u(e, "regexp")]),
|
|
720
|
+
m("label", null, [this.wordField, u(e, "by word")]),
|
|
754
721
|
...e.state.readOnly ? [] : [
|
|
755
|
-
|
|
722
|
+
m("br"),
|
|
756
723
|
this.replaceField,
|
|
757
|
-
|
|
758
|
-
|
|
724
|
+
n("replace", () => j(e), [u(e, "replace")]),
|
|
725
|
+
n("replaceAll", () => Be(e), [u(e, "replace all")])
|
|
759
726
|
],
|
|
760
|
-
|
|
727
|
+
m("button", {
|
|
761
728
|
name: "close",
|
|
762
|
-
onclick: () =>
|
|
763
|
-
"aria-label":
|
|
729
|
+
onclick: () => oe(e),
|
|
730
|
+
"aria-label": u(e, "close"),
|
|
764
731
|
type: "button"
|
|
765
732
|
}, ["×"])
|
|
766
733
|
]);
|
|
767
734
|
}
|
|
768
735
|
commit() {
|
|
769
|
-
let e = new
|
|
736
|
+
let e = new ne({
|
|
770
737
|
search: this.searchField.value,
|
|
771
738
|
caseSensitive: this.caseField.checked,
|
|
772
739
|
regexp: this.reField.checked,
|
|
773
740
|
wholeWord: this.wordField.checked,
|
|
774
741
|
replace: this.replaceField.value
|
|
775
742
|
});
|
|
776
|
-
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects:
|
|
743
|
+
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: L.of(e) }));
|
|
777
744
|
}
|
|
778
745
|
keydown(e) {
|
|
779
|
-
|
|
746
|
+
ue(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? P : w)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), j(this.view));
|
|
780
747
|
}
|
|
781
748
|
update(e) {
|
|
782
|
-
for (let
|
|
783
|
-
for (let
|
|
784
|
-
|
|
749
|
+
for (let t of e.transactions)
|
|
750
|
+
for (let n of t.effects)
|
|
751
|
+
n.is(L) && !n.value.eq(this.query) && this.setQuery(n.value);
|
|
785
752
|
}
|
|
786
753
|
setQuery(e) {
|
|
787
754
|
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;
|
|
@@ -793,32 +760,32 @@ class Ve {
|
|
|
793
760
|
return 80;
|
|
794
761
|
}
|
|
795
762
|
get top() {
|
|
796
|
-
return this.view.state.facet(
|
|
763
|
+
return this.view.state.facet(b).top;
|
|
797
764
|
}
|
|
798
765
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
766
|
+
function u(r, e) {
|
|
767
|
+
return r.state.phrase(e);
|
|
801
768
|
}
|
|
802
|
-
const
|
|
803
|
-
function
|
|
804
|
-
let
|
|
805
|
-
if (s !=
|
|
806
|
-
for (let
|
|
807
|
-
if (!
|
|
808
|
-
|
|
769
|
+
const E = 30, F = /[\s\.,:;?!]/;
|
|
770
|
+
function N(r, { from: e, to: t }) {
|
|
771
|
+
let n = r.state.doc.lineAt(e), i = r.state.doc.lineAt(t).to, s = Math.max(n.from, e - E), l = Math.min(i, t + E), c = r.state.sliceDoc(s, l);
|
|
772
|
+
if (s != n.from) {
|
|
773
|
+
for (let o = 0; o < E; o++)
|
|
774
|
+
if (!F.test(c[o + 1]) && F.test(c[o])) {
|
|
775
|
+
c = c.slice(o);
|
|
809
776
|
break;
|
|
810
777
|
}
|
|
811
778
|
}
|
|
812
779
|
if (l != i) {
|
|
813
|
-
for (let
|
|
814
|
-
if (!
|
|
815
|
-
|
|
780
|
+
for (let o = c.length - 1; o > c.length - E; o--)
|
|
781
|
+
if (!F.test(c[o - 1]) && F.test(c[o])) {
|
|
782
|
+
c = c.slice(0, o);
|
|
816
783
|
break;
|
|
817
784
|
}
|
|
818
785
|
}
|
|
819
|
-
return
|
|
786
|
+
return S.announce.of(`${r.state.phrase("current match")}. ${c} ${r.state.phrase("on line")} ${n.number}.`);
|
|
820
787
|
}
|
|
821
|
-
const
|
|
788
|
+
const Ve = /* @__PURE__ */ S.baseTheme({
|
|
822
789
|
".cm-panel.cm-search": {
|
|
823
790
|
padding: "2px 6px 4px",
|
|
824
791
|
position: "relative",
|
|
@@ -847,26 +814,26 @@ const He = /* @__PURE__ */ x.baseTheme({
|
|
|
847
814
|
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
848
815
|
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
849
816
|
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
850
|
-
}),
|
|
851
|
-
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
|
|
817
|
+
}), He = [
|
|
818
|
+
x,
|
|
819
|
+
/* @__PURE__ */ de.low(Qe),
|
|
820
|
+
Ve
|
|
854
821
|
];
|
|
855
822
|
export {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
823
|
+
te as RegExpCursor,
|
|
824
|
+
C as SearchCursor,
|
|
825
|
+
ne as SearchQuery,
|
|
826
|
+
oe as closeSearchPanel,
|
|
827
|
+
w as findNext,
|
|
828
|
+
P as findPrevious,
|
|
829
|
+
ye as gotoLine,
|
|
830
|
+
Je as highlightSelectionMatches,
|
|
831
|
+
ce as openSearchPanel,
|
|
832
|
+
Be as replaceAll,
|
|
833
|
+
j as replaceNext,
|
|
834
|
+
Ue as searchKeymap,
|
|
868
835
|
_e as selectMatches,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
836
|
+
De as selectNextOccurrence,
|
|
837
|
+
ze as selectSelectionMatches,
|
|
838
|
+
L as setSearchQuery
|
|
872
839
|
};
|