@coze-editor/vscode 0.1.0-alpha.8d7a30 → 0.1.0-alpha.9a9cc7
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/esm/index.js +7 -1222
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +2 -96
- package/dist/index.d.ts +2 -96
- package/dist/index.js +7 -1224
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/esm/index.js
CHANGED
|
@@ -1,1226 +1,11 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { search } from "@coze-editor/vscode-search";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// src/search/theme.ts
|
|
10
|
-
import { EditorView } from "@codemirror/view";
|
|
11
|
-
import { Prec } from "@codemirror/state";
|
|
12
|
-
var theme = Prec.high(
|
|
13
|
-
EditorView.theme({
|
|
14
|
-
"& .cm-panels.cm-panels-top": {
|
|
15
|
-
borderBottom: "none",
|
|
16
|
-
backgroundColor: "transparent"
|
|
17
|
-
},
|
|
18
|
-
"& .cm-panels.cm-panels-bottom": {
|
|
19
|
-
borderTop: "none",
|
|
20
|
-
backgroundColor: "transparent",
|
|
21
|
-
border: "1px solid rgba(28, 31, 35, .08)"
|
|
22
|
-
},
|
|
23
|
-
"& .cm-searchMatch": {
|
|
24
|
-
backgroundColor: "rgba(164, 164, 184, 0.3)",
|
|
25
|
-
outline: "none"
|
|
26
|
-
},
|
|
27
|
-
"& .cm-custom-search": {
|
|
28
|
-
position: "absolute",
|
|
29
|
-
top: 0,
|
|
30
|
-
right: "10px",
|
|
31
|
-
backgroundColor: "#f3f3f3",
|
|
32
|
-
display: "flex",
|
|
33
|
-
padding: "4px",
|
|
34
|
-
boxSizing: "border-box",
|
|
35
|
-
minWidth: "420px",
|
|
36
|
-
maxWidth: "calc(100% - 30px)",
|
|
37
|
-
borderRadius: "4px",
|
|
38
|
-
boxShadow: "0 2px 8px 2px rgba(0, 0, 0, 0.16)",
|
|
39
|
-
overflow: "hidden"
|
|
40
|
-
},
|
|
41
|
-
"& .cm-custom-search button": {
|
|
42
|
-
borderWidth: 0
|
|
43
|
-
},
|
|
44
|
-
"& .cm-custom-search input": {
|
|
45
|
-
outline: "none"
|
|
46
|
-
},
|
|
47
|
-
"& .cm-custom-search .cm-custom-search-drag": {
|
|
48
|
-
width: "3px",
|
|
49
|
-
height: "100%",
|
|
50
|
-
position: "absolute",
|
|
51
|
-
top: "0px",
|
|
52
|
-
left: "0px",
|
|
53
|
-
backgroundColor: "#c8c8c8"
|
|
54
|
-
},
|
|
55
|
-
"& .cm-custom-search .cm-custom-search-drag:hover": {
|
|
56
|
-
backgroundColor: "#0090f1",
|
|
57
|
-
cursor: "col-resize"
|
|
58
|
-
},
|
|
59
|
-
"& .cm-custom-text-field": {
|
|
60
|
-
backgroundColor: "inherit",
|
|
61
|
-
padding: 0,
|
|
62
|
-
border: "none",
|
|
63
|
-
color: "#444d56",
|
|
64
|
-
fontSize: "12px",
|
|
65
|
-
lineHeight: "16px",
|
|
66
|
-
verticalAlign: "middle",
|
|
67
|
-
width: "calc(100% - 58px)"
|
|
68
|
-
},
|
|
69
|
-
"& .cm-custom-search-panel-icon": {
|
|
70
|
-
display: "inline-flex",
|
|
71
|
-
"align-items": "center",
|
|
72
|
-
"justify-content": "center",
|
|
73
|
-
padding: "4px",
|
|
74
|
-
"border-radius": "2px",
|
|
75
|
-
"background-color": "transparent",
|
|
76
|
-
"box-sizing": "border-box",
|
|
77
|
-
width: "20px",
|
|
78
|
-
height: "20px",
|
|
79
|
-
cursor: "pointer"
|
|
80
|
-
},
|
|
81
|
-
"& .cm-custom-search-panel-icon:hover": {
|
|
82
|
-
color: "rgba(0, 100, 250, 1)",
|
|
83
|
-
backgroundColor: "rgba(46, 60, 56, .09)"
|
|
84
|
-
},
|
|
85
|
-
"& .cm-custom-search-panel-icon:active": {
|
|
86
|
-
backgroundColor: "rgba(46, 50, 56, .13)"
|
|
87
|
-
},
|
|
88
|
-
"& .cm-custom-search-panel-icon span": {
|
|
89
|
-
display: "inline-flex",
|
|
90
|
-
lineHeight: "12px",
|
|
91
|
-
fontSize: "12px"
|
|
92
|
-
},
|
|
93
|
-
"& .cm-custom-search-panel-icon-active": {
|
|
94
|
-
color: "rgba(0, 100, 250, 1)",
|
|
95
|
-
backgroundColor: "rgba(46, 50, 56, .05)"
|
|
96
|
-
},
|
|
97
|
-
"& .cm-custom-search-panel-icon-disabled": {
|
|
98
|
-
color: "rgba(28, 31, 35, .35)",
|
|
99
|
-
backgroundColor: "transparent"
|
|
100
|
-
},
|
|
101
|
-
"& .cm-custom-search-panel-icon-disabled:hover": {
|
|
102
|
-
color: "rgba(28, 31, 35, .35)",
|
|
103
|
-
backgroundColor: "transparent"
|
|
104
|
-
},
|
|
105
|
-
"& .cm-custom-search-panel-icon-disabled:active": {
|
|
106
|
-
color: "rgba(28, 31, 35, .35)",
|
|
107
|
-
backgroundColor: "transparent"
|
|
108
|
-
},
|
|
109
|
-
"& .cm-custom-search-panel-expand": {
|
|
110
|
-
display: "flex",
|
|
111
|
-
padding: "4px"
|
|
112
|
-
},
|
|
113
|
-
"& .cm-custom-search-panel-content": {
|
|
114
|
-
display: "flex",
|
|
115
|
-
flexDirection: "column",
|
|
116
|
-
flex: 1
|
|
117
|
-
},
|
|
118
|
-
"& .cm-custom-search-panel-content-top": {
|
|
119
|
-
display: "flex",
|
|
120
|
-
alignItems: "center"
|
|
121
|
-
},
|
|
122
|
-
"& .cm-custom-search-action-wrapper": {
|
|
123
|
-
display: "flex",
|
|
124
|
-
alignItems: "center",
|
|
125
|
-
justifyContent: "end"
|
|
126
|
-
},
|
|
127
|
-
"& .cm-custom-search-panel-content-input-wrapper": {
|
|
128
|
-
display: "flex",
|
|
129
|
-
alignItems: "center",
|
|
130
|
-
flex: 1,
|
|
131
|
-
position: "relative",
|
|
132
|
-
border: "1px solid #555",
|
|
133
|
-
padding: "4px",
|
|
134
|
-
minWidth: "220px",
|
|
135
|
-
marginLeft: "4px",
|
|
136
|
-
marginRight: "6px",
|
|
137
|
-
borderRadius: "2px"
|
|
138
|
-
},
|
|
139
|
-
"& .cm-custom-search-panel-content-input-wrapper-focus": {
|
|
140
|
-
borderColor: "rgba(0, 100, 250, 1)"
|
|
141
|
-
},
|
|
142
|
-
"& .cm-custom-search-panel-content-input-wrapper .cm-custom-search-panel-icon": {
|
|
143
|
-
position: "absolute",
|
|
144
|
-
top: "4px",
|
|
145
|
-
right: "4px",
|
|
146
|
-
padding: "2px",
|
|
147
|
-
width: "16px",
|
|
148
|
-
height: "16px !important"
|
|
149
|
-
},
|
|
150
|
-
"& .cm-panel.cm-custom-search [name=word]": {
|
|
151
|
-
right: "22px"
|
|
152
|
-
},
|
|
153
|
-
"& .cm-panel.cm-custom-search [name=case]": {
|
|
154
|
-
right: "40px"
|
|
155
|
-
},
|
|
156
|
-
"& .cm-panel.cm-custom-search [name=enter]": {
|
|
157
|
-
right: "58px"
|
|
158
|
-
},
|
|
159
|
-
"& .cm-panel.cm-custom-search [name=previous]": {
|
|
160
|
-
marginRight: "2px"
|
|
161
|
-
},
|
|
162
|
-
"& .cm-panel.cm-custom-search [name=next]": {
|
|
163
|
-
marginRight: "2px"
|
|
164
|
-
},
|
|
165
|
-
"& .cm-panel.cm-custom-search [name=close-icon]": {
|
|
166
|
-
marginRight: "2px"
|
|
167
|
-
},
|
|
168
|
-
"& .cm-panel.cm-custom-search [name=replace]": {
|
|
169
|
-
marginRight: "2px"
|
|
170
|
-
},
|
|
171
|
-
"& .cm-panel.cm-custom-search [name=expand]": {
|
|
172
|
-
transform: "rotate(0deg)"
|
|
173
|
-
},
|
|
174
|
-
"& .cm-panel.cm-custom-search [name=expand].cm-custom-search-panel-icon-active": {
|
|
175
|
-
transform: "rotate(90deg)"
|
|
176
|
-
},
|
|
177
|
-
"& .cm-custom-search-match-count": {
|
|
178
|
-
fontSize: "12px",
|
|
179
|
-
width: "80px",
|
|
180
|
-
overflow: "hidden"
|
|
181
|
-
},
|
|
182
|
-
"& .cm-custom-search-panel-content-bottom": {
|
|
183
|
-
marginRight: "104px",
|
|
184
|
-
display: "flex",
|
|
185
|
-
alignItems: "center"
|
|
186
|
-
},
|
|
187
|
-
"& .cm-custom-search-panel-content-bottom .cm-custom-search-panel-content-input-wrapper": {
|
|
188
|
-
marginTop: "6px"
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
// src/search/panel.ts
|
|
194
|
-
import createEle3 from "crelt";
|
|
195
|
-
import {
|
|
196
|
-
runScopeHandlers
|
|
197
|
-
} from "@codemirror/view";
|
|
198
|
-
import {
|
|
199
|
-
closeSearchPanel,
|
|
200
|
-
findNext,
|
|
201
|
-
findPrevious,
|
|
202
|
-
getSearchQuery,
|
|
203
|
-
replaceAll,
|
|
204
|
-
replaceNext,
|
|
205
|
-
SearchQuery,
|
|
206
|
-
setSearchQuery
|
|
207
|
-
} from "@codemirror/search";
|
|
208
|
-
|
|
209
|
-
// src/search/dom/match-count.ts
|
|
210
|
-
import createEle from "crelt";
|
|
211
|
-
var MatchCount = class {
|
|
212
|
-
_data;
|
|
213
|
-
dom;
|
|
214
|
-
constructor(data = { matchCount: 0, matchIndex: -1, searching: false }) {
|
|
215
|
-
this._data = data;
|
|
216
|
-
this.dom = createEle("div", {
|
|
217
|
-
class: "cm-custom-search-match-count"
|
|
218
|
-
});
|
|
219
|
-
this.update();
|
|
220
|
-
}
|
|
221
|
-
update() {
|
|
222
|
-
if (this._data.matchCount > 0) {
|
|
223
|
-
this.dom.innerText = ` ${this._data.matchIndex + 1} of ${this._data.matchCount > 1e3 ? "1000+" : this._data.matchCount}`;
|
|
224
|
-
this.dom.style.color = "unset";
|
|
225
|
-
} else {
|
|
226
|
-
this.dom.innerText = "No results";
|
|
227
|
-
if (this._data.searching) {
|
|
228
|
-
this.dom.style.color = "red";
|
|
229
|
-
} else {
|
|
230
|
-
this.dom.style.color = "unset";
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
get data() {
|
|
235
|
-
return this._data;
|
|
236
|
-
}
|
|
237
|
-
set data(data) {
|
|
238
|
-
this._data = data;
|
|
239
|
-
this.update();
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
// src/search/dom/icon.ts
|
|
244
|
-
import createEle2 from "crelt";
|
|
245
|
-
var Icon = class {
|
|
246
|
-
dom;
|
|
247
|
-
_checked;
|
|
248
|
-
_disabled;
|
|
249
|
-
checkable;
|
|
250
|
-
constructor(attr = {}) {
|
|
251
|
-
const { onchange, checked, checkable = true, disabled, ...rest } = attr;
|
|
252
|
-
this.checkable = checkable;
|
|
253
|
-
this._checked = checked || false;
|
|
254
|
-
this._disabled = disabled || false;
|
|
255
|
-
this.dom = createEle2(
|
|
256
|
-
"button",
|
|
257
|
-
{
|
|
258
|
-
class: this._checked ? "cm-custom-search-panel-icon cm-custom-search-panel-icon-active" : "cm-custom-search-panel-icon",
|
|
259
|
-
type: "button",
|
|
260
|
-
onclick: () => {
|
|
261
|
-
this.checked = !this.checked;
|
|
262
|
-
onchange == null ? void 0 : onchange();
|
|
263
|
-
},
|
|
264
|
-
...rest
|
|
265
|
-
},
|
|
266
|
-
[this.getSVG()]
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
get checked() {
|
|
270
|
-
return this._checked;
|
|
271
|
-
}
|
|
272
|
-
set checked(checked) {
|
|
273
|
-
if (this.checkable) {
|
|
274
|
-
if (checked) {
|
|
275
|
-
if (!this.dom.classList.contains("cm-custom-search-panel-icon-active")) {
|
|
276
|
-
this.dom.classList.add("cm-custom-search-panel-icon-active");
|
|
277
|
-
}
|
|
278
|
-
} else {
|
|
279
|
-
this.dom.classList.remove("cm-custom-search-panel-icon-active");
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
this._checked = checked;
|
|
283
|
-
}
|
|
284
|
-
get disabled() {
|
|
285
|
-
return this._disabled;
|
|
286
|
-
}
|
|
287
|
-
set disabled(disabled) {
|
|
288
|
-
if (disabled) {
|
|
289
|
-
if (!this.dom.classList.contains("cm-custom-search-panel-icon-disabled")) {
|
|
290
|
-
this.dom.classList.add("cm-custom-search-panel-icon-disabled");
|
|
291
|
-
}
|
|
292
|
-
} else {
|
|
293
|
-
this.dom.classList.remove("cm-custom-search-panel-icon-disabled");
|
|
294
|
-
}
|
|
295
|
-
this._disabled = disabled;
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
var IconCaseSensitive = class extends Icon {
|
|
299
|
-
constructor(attr = {}) {
|
|
300
|
-
super(attr);
|
|
301
|
-
}
|
|
302
|
-
getSVG() {
|
|
303
|
-
const span = document.createElement("span");
|
|
304
|
-
span.innerHTML = `<svg
|
|
305
|
-
viewBox="0 0 24 24"
|
|
306
|
-
fill="none"
|
|
307
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
308
|
-
width="1em"
|
|
309
|
-
height="1em"
|
|
310
|
-
focusable="false"
|
|
311
|
-
aria-hidden="true"
|
|
312
|
-
>
|
|
313
|
-
<path
|
|
314
|
-
fill-rule="evenodd"
|
|
315
|
-
clip-rule="evenodd"
|
|
316
|
-
d="M8.91798 4.01101C8.70936 3.40601 8.13988 3 7.49992 3C6.85996 3 6.29048 3.40601 6.08186 4.01101L1.08186 18.511C0.811801 19.2942 1.22776 20.148 2.01093 20.4181C2.79411 20.6881 3.64792 20.2722 3.91798 19.489L4.94866 16.5H10.0512L11.0819 19.489C11.3519 20.2722 12.2057 20.6881 12.9889 20.4181C13.7721 20.148 14.188 19.2942 13.918 18.511L8.91798 4.01101ZM9.01669 13.5H5.98315L7.49992 9.10136L9.01669 13.5ZM15.9999 14.5C15.9999 12.4705 17.2243 11.5 17.9999 11.5C18.7755 11.5 19.9999 12.4705 19.9999 14.5C19.9999 16.5295 18.7755 17.5 17.9999 17.5C17.2243 17.5 15.9999 16.5295 15.9999 14.5ZM17.9999 8.5C18.8536 8.5 19.6173 8.73345 20.2754 9.13338C20.5471 8.75013 20.9943 8.5 21.4999 8.5C22.3283 8.5 22.9999 9.17157 22.9999 10V19C22.9999 19.8284 22.3283 20.5 21.4999 20.5C20.9943 20.5 20.5471 20.2499 20.2754 19.8666C19.6173 20.2665 18.8536 20.5 17.9999 20.5C14.9095 20.5 12.9999 17.441 12.9999 14.5C12.9999 11.559 14.9095 8.5 17.9999 8.5Z"
|
|
317
|
-
fill="currentColor"
|
|
318
|
-
/>
|
|
319
|
-
</svg>`;
|
|
320
|
-
return span;
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
var IconRegExp = class extends Icon {
|
|
324
|
-
constructor(attr = {}) {
|
|
325
|
-
super(attr);
|
|
326
|
-
}
|
|
327
|
-
getSVG() {
|
|
328
|
-
const span = document.createElement("span");
|
|
329
|
-
span.innerHTML = `<svg
|
|
330
|
-
viewBox="0 0 24 24"
|
|
331
|
-
fill="none"
|
|
332
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
333
|
-
width="1em"
|
|
334
|
-
height="1em"
|
|
335
|
-
focusable=false
|
|
336
|
-
aria-hidden=true
|
|
337
|
-
>
|
|
338
|
-
<path
|
|
339
|
-
fill-rule="evenodd"
|
|
340
|
-
clip-rule="evenodd"
|
|
341
|
-
d="M16.7519 1C17.5803 1 18.2519 1.67157 18.2519 2.5V5.19722L20.4198 3.75192C21.1091 3.2924 22.0404 3.47866 22.4999 4.16795C22.9595 4.85724 22.7732 5.78855 22.0839 6.24808L19.456 8L22.0839 9.75192C22.7732 10.2115 22.9595 11.1428 22.4999 11.8321C22.0404 12.5213 21.1091 12.7076 20.4198 12.2481L18.2519 10.8028V13.5C18.2519 14.3284 17.5803 15 16.7519 15C15.9234 15 15.2519 14.3284 15.2519 13.5V10.8028L13.0839 12.2481C12.3946 12.7076 11.4633 12.5213 11.0038 11.8321C10.5443 11.1428 10.7305 10.2115 11.4198 9.75192L14.0477 8L11.4198 6.24808C10.7305 5.78855 10.5443 4.85724 11.0038 4.16795C11.4633 3.47866 12.3946 3.2924 13.0839 3.75192L15.2519 5.19722V2.5C15.2519 1.67157 15.9234 1 16.7519 1Z"
|
|
342
|
-
fill="currentColor"
|
|
343
|
-
/>
|
|
344
|
-
<circle cx=6.5 cy=17.5 r=4.5 fill="currentColor" />
|
|
345
|
-
</svg>`;
|
|
346
|
-
return span;
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
var IconWholeWord = class extends Icon {
|
|
350
|
-
constructor(attr = {}) {
|
|
351
|
-
super(attr);
|
|
352
|
-
}
|
|
353
|
-
getSVG() {
|
|
354
|
-
const span = document.createElement("span");
|
|
355
|
-
span.innerHTML = `<svg
|
|
356
|
-
viewBox="0 0 24 24"
|
|
357
|
-
fill="none"
|
|
358
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
359
|
-
width="1em"
|
|
360
|
-
height="1em"
|
|
361
|
-
focusable=false
|
|
362
|
-
aria-hidden=true
|
|
363
|
-
>
|
|
364
|
-
<path
|
|
365
|
-
fill-rule="evenodd"
|
|
366
|
-
clip-rule="evenodd"
|
|
367
|
-
d="M7.49995 5C8.13071 5 8.69408 5.3946 8.90964 5.98739L12.9096 16.9874C13.1927 17.7659 12.7911 18.6266 12.0126 18.9097C11.234 19.1928 10.3734 18.7912 10.0903 18.0126L9.54022 16.5H5.45968L4.90964 18.0126C4.62653 18.7912 3.76588 19.1928 2.98733 18.9097C2.20878 18.6266 1.80715 17.7659 2.09026 16.9874L6.09026 5.98739C6.30582 5.3946 6.86919 5 7.49995 5ZM6.55059 13.5H8.44931L7.49995 10.8893L6.55059 13.5Z"
|
|
368
|
-
fill="currentColor"
|
|
369
|
-
/>
|
|
370
|
-
<path
|
|
371
|
-
fill-rule="evenodd"
|
|
372
|
-
clip-rule="evenodd"
|
|
373
|
-
d="M1.99991 3C1.99991 2.44772 2.44762 2 2.99991 2H20.9999C21.5522 2 21.9999 2.44772 21.9999 3C21.9999 3.55228 21.5522 4 20.9999 4H2.99991C2.44762 4 1.99991 3.55228 1.99991 3Z"
|
|
374
|
-
fill="currentColor"
|
|
375
|
-
/>
|
|
376
|
-
<path
|
|
377
|
-
fill-rule="evenodd"
|
|
378
|
-
clip-rule="evenodd"
|
|
379
|
-
d="M1.98731 21C1.98731 20.4477 2.43502 20 2.98731 20H20.9999C21.5522 20 21.9999 20.4477 21.9999 21C21.9999 21.5523 21.5522 22 20.9999 22H2.98731C2.43502 22 1.98731 21.5523 1.98731 21Z"
|
|
380
|
-
fill="currentColor"
|
|
381
|
-
/>
|
|
382
|
-
<path
|
|
383
|
-
fill-rule="evenodd"
|
|
384
|
-
clip-rule="evenodd"
|
|
385
|
-
d="M15.4999 5C16.3283 5 16.9999 5.67157 16.9999 6.5V10C18.2261 10 19.4566 10.3372 20.4137 11.1053C21.4065 11.9022 21.9999 13.0847 21.9999 14.5C21.9999 15.9153 21.4065 17.0978 20.4137 17.8947C19.4566 18.6628 18.2261 19 16.9999 19L14.9999 19C14.4476 19 13.9999 18.5523 13.9999 18V6.5C13.9999 5.67157 14.6714 5 15.4999 5ZM16.9999 13V16C17.7067 16 18.2261 15.8036 18.5358 15.555C18.8098 15.3352 18.9999 15.0177 18.9999 14.5C18.9999 13.9823 18.8098 13.6648 18.5358 13.4449C18.2261 13.1963 17.7066 13 16.9999 13Z"
|
|
386
|
-
fill="currentColor"
|
|
387
|
-
/>
|
|
388
|
-
</svg>`;
|
|
389
|
-
return span;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
var IconArrowUp = class extends Icon {
|
|
393
|
-
constructor(attr = {}) {
|
|
394
|
-
super({ ...attr, checkable: false });
|
|
395
|
-
}
|
|
396
|
-
getSVG() {
|
|
397
|
-
const span = document.createElement("span");
|
|
398
|
-
span.innerHTML = `<svg
|
|
399
|
-
viewBox="0 0 24 24"
|
|
400
|
-
fill="none"
|
|
401
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
402
|
-
width="1em"
|
|
403
|
-
height="1em"
|
|
404
|
-
focusable=false
|
|
405
|
-
aria-hidden=true
|
|
406
|
-
>
|
|
407
|
-
<path
|
|
408
|
-
fill-rule="evenodd"
|
|
409
|
-
clip-rule="evenodd"
|
|
410
|
-
d="M12 23C11.1716 23 10.5 22.3284 10.5 21.5L10.5 6.12132L4.06066 12.5607C3.47487 13.1464 2.52513 13.1464 1.93934 12.5607C1.35355 11.9749 1.35355 11.0251 1.93934 10.4393L10.9393 1.43934C11.5251 0.853554 12.4749 0.853554 13.0607 1.43934L22.0607 10.4393C22.6464 11.0251 22.6464 11.9749 22.0607 12.5607C21.4749 13.1464 20.5251 13.1464 19.9393 12.5607L13.5 6.12132L13.5 21.5C13.5 22.3284 12.8284 23 12 23Z"
|
|
411
|
-
fill="currentColor"
|
|
412
|
-
/>
|
|
413
|
-
</svg>`;
|
|
414
|
-
return span;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
var IconArrowDown = class extends Icon {
|
|
418
|
-
constructor(attr = {}) {
|
|
419
|
-
super({ ...attr, checkable: false });
|
|
420
|
-
}
|
|
421
|
-
getSVG() {
|
|
422
|
-
const span = document.createElement("span");
|
|
423
|
-
span.innerHTML = `<svg
|
|
424
|
-
viewBox="0 0 24 24"
|
|
425
|
-
fill="none"
|
|
426
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
427
|
-
width="1em"
|
|
428
|
-
height="1em"
|
|
429
|
-
focusable=false
|
|
430
|
-
aria-hidden=true
|
|
431
|
-
>
|
|
432
|
-
<path
|
|
433
|
-
fill-rule="evenodd"
|
|
434
|
-
clip-rule="evenodd"
|
|
435
|
-
d="M12 1C12.8284 1 13.5 1.67157 13.5 2.5V17.8787L19.9393 11.4393C20.5251 10.8536 21.4749 10.8536 22.0607 11.4393C22.6464 12.0251 22.6464 12.9749 22.0607 13.5607L13.0607 22.5607C12.4749 23.1464 11.5251 23.1464 10.9393 22.5607L1.93934 13.5607C1.35355 12.9749 1.35355 12.0251 1.93934 11.4393C2.52513 10.8536 3.47487 10.8536 4.06066 11.4393L10.5 17.8787V2.5C10.5 1.67157 11.1716 1 12 1Z"
|
|
436
|
-
fill="currentColor"
|
|
437
|
-
/>
|
|
438
|
-
</svg>`;
|
|
439
|
-
return span;
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
var IconReplace = class extends Icon {
|
|
443
|
-
constructor(attr = {}) {
|
|
444
|
-
super({ ...attr, checkable: false });
|
|
445
|
-
}
|
|
446
|
-
getSVG() {
|
|
447
|
-
const span = document.createElement("span");
|
|
448
|
-
span.innerHTML = '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="14" height="14"><path d="M206.144 239.296l144.704 145.216L492.8 242.176l-44.8-44.8-64.768 64.448-0.512-102.4a33.472 33.472 0 0 1 32-33.664H512V64H414.72A94.848 94.848 0 0 0 320 159.296V262.4L251.328 194.112l-45.184 45.184z m426.88 114.816h0.64c11.712 19.904 28.864 29.888 51.584 29.888 25.152 0 45.184-10.752 60.16-32.192 15.104-21.44 22.592-49.92 22.592-85.312 0-32.704-6.4-58.432-19.264-77.248-12.864-18.88-31.232-28.288-55.04-28.288-25.92 0-45.952 12.416-60.032 37.184h-0.64V64H576v314.816h56.96v-24.704z m-0.96-67.904v-21.76c0-15.872 3.712-28.672 11.2-38.464a34.56 34.56 0 0 1 28.48-14.72 31.36 31.36 0 0 1 27.904 14.912c6.656 9.856 9.92 23.552 9.92 41.152 0 21.12-3.584 37.568-10.816 49.152a33.536 33.536 0 0 1-30.08 17.28 31.68 31.68 0 0 1-26.304-13.504 54.592 54.592 0 0 1-10.24-34.048zM576 817.216c-16.384 9.856-40 14.784-70.912 14.784-36.032 0-65.28-11.392-87.616-34.112-22.336-22.72-33.472-52.032-33.472-87.936 0-41.472 11.904-74.112 35.84-97.92 23.936-24.064 56-36.032 96-36.032 27.712 0 47.744 3.84 60.16 11.456v63.872a80.64 80.64 0 0 0-50.688-17.664c-20.8 0-37.312 6.4-49.536 19.072-12.16 12.544-18.112 29.952-18.112 52.224 0 21.632 5.76 38.592 17.408 51.008 11.648 12.224 27.584 18.368 47.936 18.368 18.048 0 35.712-5.888 52.992-17.664v60.544zM256 448L192 512v384l64 64h448l64-64V512l-64-64H256z m0 64h448v384H256V512z" fill="currentColor"></path></svg>';
|
|
449
|
-
return span;
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
var IconReplaceAll = class extends Icon {
|
|
453
|
-
constructor(attr = {}) {
|
|
454
|
-
super({ ...attr, checkable: false });
|
|
455
|
-
}
|
|
456
|
-
getSVG() {
|
|
457
|
-
const span = document.createElement("span");
|
|
458
|
-
span.innerHTML = '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="14" height="14"><path d="M742.4 171.328c9.408-19.84 22.784-29.76 40.064-29.76 15.872 0 28.16 7.552 36.672 22.592 8.576 15.104 12.864 35.648 12.864 61.824 0 28.352-4.992 51.072-15.04 68.288-9.984 17.152-23.36 25.728-40.128 25.728-15.168 0-26.624-8-34.368-23.936h-0.512v19.84H704V64h37.952v107.328h0.512z m-1.024 70.4a49.92 49.92 0 0 0 6.848 27.264c4.544 7.232 10.432 10.816 17.536 10.816 8.704 0 15.36-4.608 20.096-13.824 4.8-9.28 7.232-22.4 7.232-39.36 0-14.08-2.24-24.96-6.656-32.896-4.288-7.936-10.496-11.968-18.56-11.968-7.68 0-14.016 3.968-19.008 11.84a56.704 56.704 0 0 0-7.488 30.72v17.408zM263.68 492.48L128 356.352l42.368-42.368 64.384 64v-96.64A88.96 88.96 0 0 1 323.52 192H473.6v57.92H323.52a31.36 31.36 0 0 0-29.952 31.552l0.448 96 60.736-60.416 41.984 41.984-133.12 133.44zM598.784 315.52H640V206.08C640 154.112 619.84 128 579.584 128c-8.64 0-18.24 1.536-28.8 4.672a92.416 92.416 0 0 0-24.832 10.688v42.56c15.168-12.992 31.168-19.456 48-19.456 16.704 0 25.088 9.984 25.088 30.016l-38.4 6.592c-32.384 5.504-48.64 25.984-48.64 61.504 0 16.832 3.904 30.272 11.712 40.384A39.04 39.04 0 0 0 556.16 320c18.56 0 32.576-10.24 42.048-30.72h0.576v26.24z m0.256-86.72v12.352c0 11.2-2.56 20.48-7.68 27.904a23.552 23.552 0 0 1-20.032 10.88 17.664 17.664 0 0 1-14.08-6.08 24.32 24.32 0 0 1-5.12-15.872c0-14.208 7.04-22.464 21.248-24.896l25.6-4.288zM448 827.52h-41.216v-26.24h-0.576c-9.472 20.48-23.488 30.72-42.048 30.72a39.04 39.04 0 0 1-32.448-15.04c-7.808-10.112-11.712-23.552-11.712-40.32 0-35.584 16.256-56.064 48.64-61.568l38.4-6.592c0-20.032-8.32-30.08-25.088-30.08-16.832 0-32.832 6.528-48 19.52v-42.56c6.08-4.032 14.336-7.616 24.832-10.688 10.56-3.136 20.16-4.672 28.8-4.672 40.32 0 60.416 26.048 60.416 78.08v109.44z m-40.96-74.368v-12.352l-25.6 4.352c-14.208 2.368-21.312 10.624-21.312 24.832 0 6.4 1.728 11.712 5.12 15.872a17.664 17.664 0 0 0 14.08 6.08 23.552 23.552 0 0 0 19.968-10.88c5.12-7.424 7.68-16.64 7.68-27.904zM592.768 832c20.544 0 36.352-3.712 47.232-11.072v-45.44a57.6 57.6 0 0 1-35.328 13.248 39.616 39.616 0 0 1-32-13.76c-7.68-9.28-11.584-22.08-11.584-38.272 0-16.64 4.032-29.696 12.096-39.168a41.216 41.216 0 0 1 33.024-14.272c12.416 0 23.68 4.416 33.792 13.248v-47.936c-8.256-5.76-21.632-8.576-40.064-8.576-26.688 0-48.064 8.96-64.064 27.008-15.936 17.92-23.872 42.368-23.872 73.472 0 26.88 7.424 48.896 22.336 65.92 14.848 17.088 34.368 25.6 58.432 25.6zM128 576l64-64h576l64 64v320l-64 64H192l-64-64V576z m64 0v320h576V576H192z m192-128l64-64h448l64 64v320l-64 64V448H384z" fill="currentColor"></path></svg>';
|
|
459
|
-
return span;
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
var IconClose = class extends Icon {
|
|
463
|
-
constructor(attr = {}) {
|
|
464
|
-
super({ ...attr, checkable: false });
|
|
465
|
-
}
|
|
466
|
-
getSVG() {
|
|
467
|
-
const span = document.createElement("span");
|
|
468
|
-
span.innerHTML = `<svg
|
|
469
|
-
viewBox="0 0 24 24"
|
|
470
|
-
fill="none"
|
|
471
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
472
|
-
width="1em"
|
|
473
|
-
height="1em"
|
|
474
|
-
focusable=false
|
|
475
|
-
aria-hidden=true
|
|
476
|
-
>
|
|
477
|
-
<path
|
|
478
|
-
d="M17.6568 19.7782C18.2426 20.3639 19.1924 20.3639 19.7782 19.7782C20.3639 19.1924 20.3639 18.2426 19.7782 17.6568L14.1213 12L19.7782 6.34313C20.3639 5.75734 20.3639 4.8076 19.7782 4.22181C19.1924 3.63602 18.2426 3.63602 17.6568 4.22181L12 9.87866L6.34313 4.22181C5.75734 3.63602 4.8076 3.63602 4.22181 4.22181C3.63602 4.8076 3.63602 5.75734 4.22181 6.34313L9.87866 12L4.22181 17.6568C3.63602 18.2426 3.63602 19.1924 4.22181 19.7782C4.8076 20.3639 5.75734 20.3639 6.34313 19.7782L12 14.1213L17.6568 19.7782Z"
|
|
479
|
-
fill="currentColor"
|
|
480
|
-
/>
|
|
481
|
-
</svg>`;
|
|
482
|
-
return span;
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
var IconChevronRight = class extends Icon {
|
|
486
|
-
constructor(attr = {}) {
|
|
487
|
-
super({ ...attr });
|
|
488
|
-
}
|
|
489
|
-
getSVG() {
|
|
490
|
-
const span = document.createElement("span");
|
|
491
|
-
span.innerHTML = `<svg
|
|
492
|
-
viewBox="0 0 24 24"
|
|
493
|
-
fill="none"
|
|
494
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
495
|
-
width="1em"
|
|
496
|
-
height="1em"
|
|
497
|
-
focusable=false
|
|
498
|
-
aria-hidden=true
|
|
499
|
-
>
|
|
500
|
-
<path
|
|
501
|
-
fill-rule="evenodd"
|
|
502
|
-
clip-rule="evenodd"
|
|
503
|
-
d="M7.43934 19.7957C6.85355 19.2099 6.85355 18.2601 7.43934 17.6744L13.0962 12.0175L7.43934 6.36065C6.85355 5.77486 6.85355 4.82511 7.43934 4.23933C8.02513 3.65354 8.97487 3.65354 9.56066 4.23933L16.2782 10.9568C16.864 11.5426 16.864 12.4924 16.2782 13.0782L9.56066 19.7957C8.97487 20.3815 8.02513 20.3815 7.43934 19.7957Z"
|
|
504
|
-
fill="currentColor"
|
|
505
|
-
/>
|
|
506
|
-
</svg>`;
|
|
507
|
-
return span;
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
// src/search/panel.ts
|
|
512
|
-
var SearchPanel = class {
|
|
513
|
-
constructor(view) {
|
|
514
|
-
this.view = view;
|
|
515
|
-
this.commit = this.commit.bind(this);
|
|
516
|
-
this.query = getSearchQuery(view.state);
|
|
517
|
-
this.matchCount = new MatchCount();
|
|
518
|
-
const searchLine = this.initSearchLine(view);
|
|
519
|
-
const replaceLine = this.initReplaceLine(view);
|
|
520
|
-
const replaceLineStatus = () => {
|
|
521
|
-
var _a;
|
|
522
|
-
if (view.state.readOnly) {
|
|
523
|
-
replaceLine.style.display = "none";
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
if (!((_a = this.expand) == null ? void 0 : _a.checked)) {
|
|
527
|
-
replaceLine.style.display = "none";
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
replaceLine.style.display = "flex";
|
|
531
|
-
};
|
|
532
|
-
replaceLineStatus();
|
|
533
|
-
const expand = this.initExpandButton(view, () => replaceLineStatus());
|
|
534
|
-
const onMouseDown = useDragSearchPanel(this);
|
|
535
|
-
this.dom = createEle3(
|
|
536
|
-
"div",
|
|
537
|
-
{
|
|
538
|
-
onkeydown: (e) => this.keydown(e),
|
|
539
|
-
class: "cm-custom-search"
|
|
540
|
-
},
|
|
541
|
-
[
|
|
542
|
-
createEle3("div", {
|
|
543
|
-
class: "cm-custom-search-drag",
|
|
544
|
-
onmousedown: onMouseDown
|
|
545
|
-
}),
|
|
546
|
-
...expand,
|
|
547
|
-
createEle3(
|
|
548
|
-
"div",
|
|
549
|
-
{
|
|
550
|
-
class: "cm-custom-search-panel-content"
|
|
551
|
-
},
|
|
552
|
-
[searchLine, replaceLine]
|
|
553
|
-
)
|
|
554
|
-
]
|
|
555
|
-
);
|
|
556
|
-
this.updateMatchCount(view.state, this.query);
|
|
557
|
-
}
|
|
558
|
-
searchField;
|
|
559
|
-
replaceField;
|
|
560
|
-
matchCount;
|
|
561
|
-
caseField;
|
|
562
|
-
reField;
|
|
563
|
-
wordField;
|
|
564
|
-
expand;
|
|
565
|
-
arrowUp;
|
|
566
|
-
arrowDown;
|
|
567
|
-
replace;
|
|
568
|
-
replaceAll;
|
|
569
|
-
dom;
|
|
570
|
-
query;
|
|
571
|
-
initExpandButton(view, onExpandChange) {
|
|
572
|
-
this.expand = new IconChevronRight({
|
|
573
|
-
name: "expand",
|
|
574
|
-
title: phrase(view, "Expand"),
|
|
575
|
-
onchange: onExpandChange
|
|
576
|
-
});
|
|
577
|
-
return view.state.readOnly ? [] : [
|
|
578
|
-
createEle3(
|
|
579
|
-
"div",
|
|
580
|
-
{
|
|
581
|
-
class: "cm-custom-search-panel-expand"
|
|
582
|
-
},
|
|
583
|
-
[this.expand.dom]
|
|
584
|
-
)
|
|
585
|
-
];
|
|
586
|
-
}
|
|
587
|
-
initSearchLine(view) {
|
|
588
|
-
const inputWrapperRef = {
|
|
589
|
-
current: null
|
|
590
|
-
};
|
|
591
|
-
const handleInputFocus = () => {
|
|
592
|
-
var _a;
|
|
593
|
-
(_a = inputWrapperRef.current) == null ? void 0 : _a.focus();
|
|
594
|
-
if (inputWrapperRef.current && !inputWrapperRef.current.classList.contains(
|
|
595
|
-
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
596
|
-
)) {
|
|
597
|
-
inputWrapperRef.current.classList.add(
|
|
598
|
-
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
const handleInputBlur = () => {
|
|
603
|
-
var _a;
|
|
604
|
-
(_a = inputWrapperRef.current) == null ? void 0 : _a.blur();
|
|
605
|
-
if (inputWrapperRef.current) {
|
|
606
|
-
inputWrapperRef.current.classList.remove(
|
|
607
|
-
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
this.searchField = createEle3("input", {
|
|
612
|
-
value: this.query.search,
|
|
613
|
-
placeholder: phrase(view, "Find"),
|
|
614
|
-
title: phrase(view, "Find"),
|
|
615
|
-
class: "cm-custom-text-field",
|
|
616
|
-
name: "search",
|
|
617
|
-
form: "",
|
|
618
|
-
"main-field": "true",
|
|
619
|
-
onchange: this.commit,
|
|
620
|
-
onkeyup: this.commit,
|
|
621
|
-
onfocus: handleInputFocus,
|
|
622
|
-
onblur: handleInputBlur
|
|
623
|
-
});
|
|
624
|
-
this.caseField = new IconCaseSensitive({
|
|
625
|
-
checked: this.query.caseSensitive,
|
|
626
|
-
onchange: () => {
|
|
627
|
-
this.searchField.focus();
|
|
628
|
-
this.commit();
|
|
629
|
-
},
|
|
630
|
-
name: "case",
|
|
631
|
-
title: phrase(view, "Match Case")
|
|
632
|
-
});
|
|
633
|
-
this.reField = new IconRegExp({
|
|
634
|
-
name: "re",
|
|
635
|
-
checked: this.query.regexp,
|
|
636
|
-
onchange: () => {
|
|
637
|
-
this.searchField.focus();
|
|
638
|
-
this.commit();
|
|
639
|
-
},
|
|
640
|
-
title: phrase(view, "Use Regular Expression")
|
|
641
|
-
});
|
|
642
|
-
this.wordField = new IconWholeWord({
|
|
643
|
-
name: "word",
|
|
644
|
-
checked: this.query.wholeWord,
|
|
645
|
-
onchange: () => {
|
|
646
|
-
this.searchField.focus();
|
|
647
|
-
this.commit();
|
|
648
|
-
},
|
|
649
|
-
title: phrase(view, "Match Whole Word")
|
|
650
|
-
});
|
|
651
|
-
this.arrowUp = new IconArrowUp({
|
|
652
|
-
name: "previous",
|
|
653
|
-
onclick: () => {
|
|
654
|
-
findPrevious(view);
|
|
655
|
-
this.updateMatchCount(view.state, this.query);
|
|
656
|
-
},
|
|
657
|
-
title: phrase(view, "Previous Match")
|
|
658
|
-
});
|
|
659
|
-
this.arrowDown = new IconArrowDown({
|
|
660
|
-
name: "next",
|
|
661
|
-
onclick: () => {
|
|
662
|
-
findNext(view);
|
|
663
|
-
this.updateMatchCount(view.state, this.query);
|
|
664
|
-
},
|
|
665
|
-
title: phrase(view, "Next Match")
|
|
666
|
-
});
|
|
667
|
-
inputWrapperRef.current = createEle3(
|
|
668
|
-
"div",
|
|
669
|
-
{
|
|
670
|
-
class: "cm-custom-search-panel-content-input-wrapper"
|
|
671
|
-
},
|
|
672
|
-
[
|
|
673
|
-
this.searchField,
|
|
674
|
-
// enter.dom,
|
|
675
|
-
this.caseField.dom,
|
|
676
|
-
this.reField.dom,
|
|
677
|
-
this.wordField.dom
|
|
678
|
-
]
|
|
679
|
-
);
|
|
680
|
-
return createEle3(
|
|
681
|
-
"div",
|
|
682
|
-
{
|
|
683
|
-
class: "cm-custom-search-panel-content-top"
|
|
684
|
-
},
|
|
685
|
-
[
|
|
686
|
-
inputWrapperRef.current,
|
|
687
|
-
this.matchCount.dom,
|
|
688
|
-
createEle3(
|
|
689
|
-
"div",
|
|
690
|
-
{
|
|
691
|
-
class: "cm-custom-search-action-wrapper"
|
|
692
|
-
},
|
|
693
|
-
[
|
|
694
|
-
this.arrowUp.dom,
|
|
695
|
-
this.arrowDown.dom,
|
|
696
|
-
new IconClose({
|
|
697
|
-
name: "close-icon",
|
|
698
|
-
onclick: () => closeSearchPanel(view),
|
|
699
|
-
title: phrase(view, "Close")
|
|
700
|
-
}).dom
|
|
701
|
-
]
|
|
702
|
-
)
|
|
703
|
-
]
|
|
704
|
-
);
|
|
705
|
-
}
|
|
706
|
-
initReplaceLine(view) {
|
|
707
|
-
const inputWrapperRef = {
|
|
708
|
-
current: null
|
|
709
|
-
};
|
|
710
|
-
const handleInputFocus = () => {
|
|
711
|
-
var _a;
|
|
712
|
-
(_a = inputWrapperRef.current) == null ? void 0 : _a.focus();
|
|
713
|
-
if (inputWrapperRef.current && !inputWrapperRef.current.classList.contains(
|
|
714
|
-
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
715
|
-
)) {
|
|
716
|
-
inputWrapperRef.current.classList.add(
|
|
717
|
-
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
718
|
-
);
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
const handleInputBlur = () => {
|
|
722
|
-
var _a;
|
|
723
|
-
(_a = inputWrapperRef.current) == null ? void 0 : _a.blur();
|
|
724
|
-
if (inputWrapperRef.current) {
|
|
725
|
-
inputWrapperRef.current.classList.remove(
|
|
726
|
-
"cm-custom-search-panel-content-input-wrapper-focus"
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
this.replaceField = createEle3("input", {
|
|
731
|
-
value: this.query.replace,
|
|
732
|
-
placeholder: phrase(view, "Replace"),
|
|
733
|
-
title: phrase(view, "Replace"),
|
|
734
|
-
class: "cm-custom-text-field",
|
|
735
|
-
name: "replace",
|
|
736
|
-
form: "",
|
|
737
|
-
onchange: this.commit,
|
|
738
|
-
onkeyup: this.commit,
|
|
739
|
-
onfocus: handleInputFocus,
|
|
740
|
-
onblur: handleInputBlur
|
|
741
|
-
});
|
|
742
|
-
this.replace = new IconReplace({
|
|
743
|
-
name: "replace",
|
|
744
|
-
onclick: () => {
|
|
745
|
-
replaceNext(view);
|
|
746
|
-
this.updateMatchCount(view.state, this.query);
|
|
747
|
-
},
|
|
748
|
-
title: phrase(view, "Replace")
|
|
749
|
-
});
|
|
750
|
-
this.replaceAll = new IconReplaceAll({
|
|
751
|
-
name: "replaceAll",
|
|
752
|
-
onclick: () => {
|
|
753
|
-
replaceAll(view);
|
|
754
|
-
this.updateMatchCount(view.state, this.query);
|
|
755
|
-
},
|
|
756
|
-
title: phrase(view, "Replace All")
|
|
757
|
-
});
|
|
758
|
-
inputWrapperRef.current = createEle3(
|
|
759
|
-
"div",
|
|
760
|
-
{
|
|
761
|
-
class: "cm-custom-search-panel-content-input-wrapper"
|
|
762
|
-
},
|
|
763
|
-
[this.replaceField]
|
|
764
|
-
);
|
|
765
|
-
return createEle3(
|
|
766
|
-
"div",
|
|
767
|
-
{
|
|
768
|
-
class: "cm-custom-search-panel-content-bottom"
|
|
769
|
-
},
|
|
770
|
-
[inputWrapperRef.current, this.replace.dom, this.replaceAll.dom]
|
|
771
|
-
);
|
|
772
|
-
}
|
|
773
|
-
commit() {
|
|
774
|
-
const query = new SearchQuery({
|
|
775
|
-
search: this.searchField.value,
|
|
776
|
-
caseSensitive: this.caseField.checked,
|
|
777
|
-
regexp: this.reField.checked,
|
|
778
|
-
wholeWord: this.wordField.checked,
|
|
779
|
-
replace: this.replaceField.value
|
|
780
|
-
});
|
|
781
|
-
if (!query.eq(this.query)) {
|
|
782
|
-
this.query = query;
|
|
783
|
-
this.view.dispatch({ effects: setSearchQuery.of(query) });
|
|
784
|
-
}
|
|
785
|
-
this.updateMatchCount(this.view.state, this.query);
|
|
786
|
-
}
|
|
787
|
-
keydown(e) {
|
|
788
|
-
if (runScopeHandlers(this.view, e, "search-panel")) {
|
|
789
|
-
e.preventDefault();
|
|
790
|
-
} else if (e.keyCode === 13 && e.target === this.searchField) {
|
|
791
|
-
e.preventDefault();
|
|
792
|
-
(e.shiftKey ? findPrevious : findNext)(this.view);
|
|
793
|
-
} else if (e.keyCode === 13 && e.target === this.replaceField) {
|
|
794
|
-
e.preventDefault();
|
|
795
|
-
replaceNext(this.view);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
updateMatchCount(state, query) {
|
|
799
|
-
this.matchCount.data = {
|
|
800
|
-
...findMatchIndex(state, query),
|
|
801
|
-
searching: !!query.search
|
|
802
|
-
};
|
|
803
|
-
if (this.matchCount.data.matchCount > 0) {
|
|
804
|
-
this.replace.disabled = false;
|
|
805
|
-
this.replaceAll.disabled = false;
|
|
806
|
-
this.arrowUp.disabled = false;
|
|
807
|
-
this.arrowDown.disabled = false;
|
|
808
|
-
} else {
|
|
809
|
-
this.replace.disabled = true;
|
|
810
|
-
this.replaceAll.disabled = true;
|
|
811
|
-
this.arrowUp.disabled = true;
|
|
812
|
-
this.arrowDown.disabled = true;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
update(update) {
|
|
816
|
-
for (const tr of update.transactions) {
|
|
817
|
-
for (const effect of tr.effects) {
|
|
818
|
-
if (effect.is(setSearchQuery) && !effect.value.eq(this.query)) {
|
|
819
|
-
this.setQuery(effect.value);
|
|
820
|
-
this.updateMatchCount(update.state, effect.value);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
setQuery(query) {
|
|
826
|
-
this.query = query;
|
|
827
|
-
this.searchField.value = query.search;
|
|
828
|
-
this.replaceField.value = query.replace;
|
|
829
|
-
this.caseField.checked = query.caseSensitive;
|
|
830
|
-
this.reField.checked = query.regexp;
|
|
831
|
-
this.wordField.checked = query.wholeWord;
|
|
832
|
-
}
|
|
833
|
-
mount() {
|
|
834
|
-
this.searchField.select();
|
|
835
|
-
}
|
|
836
|
-
get top() {
|
|
837
|
-
return true;
|
|
838
|
-
}
|
|
839
|
-
};
|
|
840
|
-
function phrase(view, p) {
|
|
841
|
-
return view.state.phrase(p);
|
|
842
|
-
}
|
|
843
|
-
function findMatchIndex(state, query) {
|
|
844
|
-
try {
|
|
845
|
-
const { from, to } = state.selection.main;
|
|
846
|
-
let index = 0;
|
|
847
|
-
let matchIndex = -1;
|
|
848
|
-
const cursor = query.getCursor(state);
|
|
849
|
-
let data = cursor.next();
|
|
850
|
-
while (!data.done) {
|
|
851
|
-
if (data.value.from === from && data.value.to === to) {
|
|
852
|
-
matchIndex = index;
|
|
853
|
-
}
|
|
854
|
-
data = cursor.next();
|
|
855
|
-
index++;
|
|
856
|
-
}
|
|
857
|
-
return { matchIndex, matchCount: index };
|
|
858
|
-
} catch (e) {
|
|
859
|
-
return { matchIndex: -1, matchCount: 0 };
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
function useDragSearchPanel(panel) {
|
|
863
|
-
let isResizing = false;
|
|
864
|
-
let startX = 0;
|
|
865
|
-
let startWidth = 0;
|
|
866
|
-
const onMouseMove = (e) => {
|
|
867
|
-
e.preventDefault();
|
|
868
|
-
e.stopPropagation();
|
|
869
|
-
if (!isResizing || !(panel == null ? void 0 : panel.dom)) {
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
const newWidth = startX - e.clientX + startWidth;
|
|
873
|
-
panel.dom.style.width = `${newWidth}px`;
|
|
874
|
-
};
|
|
875
|
-
const onMouseUp = (e) => {
|
|
876
|
-
e.preventDefault();
|
|
877
|
-
e.stopPropagation();
|
|
878
|
-
isResizing = false;
|
|
879
|
-
startX = 0;
|
|
880
|
-
startWidth = 0;
|
|
881
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
882
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
883
|
-
};
|
|
884
|
-
const onMouseDown = (e) => {
|
|
885
|
-
e.preventDefault();
|
|
886
|
-
e.stopPropagation();
|
|
887
|
-
isResizing = true;
|
|
888
|
-
startX = e.clientX;
|
|
889
|
-
startWidth = (panel == null ? void 0 : panel.dom.clientWidth) ?? 0;
|
|
890
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
891
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
892
|
-
};
|
|
893
|
-
return onMouseDown;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// src/search/index.ts
|
|
897
|
-
var search = () => [
|
|
898
|
-
theme,
|
|
899
|
-
nativeSearch({
|
|
900
|
-
createPanel: (view) => new SearchPanel(view)
|
|
901
|
-
}),
|
|
902
|
-
keymap.of([...searchKeymap, { key: "Ctrl-g", run: gotoLine }])
|
|
903
|
-
];
|
|
904
|
-
|
|
905
|
-
// src/themes/dark.ts
|
|
906
|
-
import { tags as t } from "@lezer/highlight";
|
|
907
|
-
import { EditorView as EditorView2 } from "@codemirror/view";
|
|
908
|
-
var config = {
|
|
909
|
-
name: "basicDark",
|
|
910
|
-
dark: true,
|
|
911
|
-
background: "#24292e",
|
|
912
|
-
foreground: "#d1d5da",
|
|
913
|
-
selection: "#3392FF44",
|
|
914
|
-
cursor: "#c8e1ff",
|
|
915
|
-
dropdownBackground: "#24292e",
|
|
916
|
-
dropdownBorder: "#1b1f23",
|
|
917
|
-
activeLine: "#4d566022",
|
|
918
|
-
matchingBracket: "#888892",
|
|
919
|
-
keyword: "#9197F1",
|
|
920
|
-
storage: "#f97583",
|
|
921
|
-
variable: "#ffab70",
|
|
922
|
-
variableName: "#D9DCFA",
|
|
923
|
-
parameter: "#e1e4e8",
|
|
924
|
-
function: "#FFCA66",
|
|
925
|
-
string: "#FF9878",
|
|
926
|
-
constant: "#79b8ff",
|
|
927
|
-
type: "#79b8ff",
|
|
928
|
-
class: "#b392f0",
|
|
929
|
-
number: "#2EC7D9",
|
|
930
|
-
comment: "#568B2A",
|
|
931
|
-
heading: "#79b8ff",
|
|
932
|
-
invalid: "#f97583",
|
|
933
|
-
regexp: "#9ecbff",
|
|
934
|
-
propertyName: "#9197F1",
|
|
935
|
-
separator: "#888892",
|
|
936
|
-
gutters: "#888892",
|
|
937
|
-
moduleKeyword: "#CC4FD4"
|
|
938
|
-
};
|
|
939
|
-
var darkTheme = () => EditorView2.theme(
|
|
940
|
-
{
|
|
941
|
-
"&": {
|
|
942
|
-
color: config.foreground,
|
|
943
|
-
backgroundColor: config.background
|
|
944
|
-
},
|
|
945
|
-
".cm-content": { caretColor: config.cursor },
|
|
946
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor: config.cursor },
|
|
947
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: config.selection },
|
|
948
|
-
".cm-panels": {
|
|
949
|
-
backgroundColor: config.dropdownBackground,
|
|
950
|
-
color: config.foreground
|
|
951
|
-
},
|
|
952
|
-
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
953
|
-
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
954
|
-
".cm-searchMatch": {
|
|
955
|
-
backgroundColor: config.dropdownBackground,
|
|
956
|
-
outline: `1px solid ${config.dropdownBorder}`
|
|
957
|
-
},
|
|
958
|
-
".cm-searchMatch.cm-searchMatch-selected": {
|
|
959
|
-
backgroundColor: config.selection
|
|
960
|
-
},
|
|
961
|
-
".cm-activeLine": { backgroundColor: config.activeLine },
|
|
962
|
-
".cm-selectionMatch": { backgroundColor: config.selection },
|
|
963
|
-
"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
|
|
964
|
-
backgroundColor: config.matchingBracket,
|
|
965
|
-
outline: "none"
|
|
966
|
-
},
|
|
967
|
-
".cm-gutters": {
|
|
968
|
-
backgroundColor: config.background,
|
|
969
|
-
color: config.gutters,
|
|
970
|
-
border: "none"
|
|
971
|
-
},
|
|
972
|
-
".cm-activeLineGutter": { backgroundColor: config.background },
|
|
973
|
-
".cm-foldPlaceholder": {
|
|
974
|
-
backgroundColor: "transparent",
|
|
975
|
-
border: "none",
|
|
976
|
-
color: config.foreground
|
|
977
|
-
},
|
|
978
|
-
".cm-tooltip": {
|
|
979
|
-
backgroundColor: config.dropdownBackground,
|
|
980
|
-
color: config.foreground,
|
|
981
|
-
border: "none",
|
|
982
|
-
boxShadow: "inset 0 0 0 1px rgba(255, 255, 255, .1), 0 4px 14px rgba(0, 0, 0, .25)!important",
|
|
983
|
-
maxWidth: "400px"
|
|
984
|
-
},
|
|
985
|
-
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
986
|
-
borderTopColor: "transparent",
|
|
987
|
-
borderBottomColor: "transparent"
|
|
988
|
-
},
|
|
989
|
-
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
990
|
-
borderTopColor: config.foreground,
|
|
991
|
-
borderBottomColor: config.foreground
|
|
992
|
-
},
|
|
993
|
-
".cm-tooltip-autocomplete": {
|
|
994
|
-
"& > ul > li[aria-selected]": {
|
|
995
|
-
background: config.selection,
|
|
996
|
-
color: config.foreground
|
|
997
|
-
}
|
|
998
|
-
},
|
|
999
|
-
".cm-tooltip code[class*=language-]": {
|
|
1000
|
-
whiteSpace: "pre-wrap",
|
|
1001
|
-
wordBreak: "break-word",
|
|
1002
|
-
color: "rgba(249, 249, 249, 1)"
|
|
1003
|
-
},
|
|
1004
|
-
"& .cm-scroller": {
|
|
1005
|
-
border: "1px solid transparent"
|
|
1006
|
-
},
|
|
1007
|
-
"& .cm-hover-tooltip-content": {
|
|
1008
|
-
fontSize: "12px",
|
|
1009
|
-
padding: "0 10px",
|
|
1010
|
-
width: "400px",
|
|
1011
|
-
overflow: "auto",
|
|
1012
|
-
"max-height": "calc(100% - 20px)"
|
|
1013
|
-
},
|
|
1014
|
-
"& .cm-hover-tooltip-content h1": {
|
|
1015
|
-
fontSize: "14px"
|
|
1016
|
-
},
|
|
1017
|
-
"& .cm-tooltip-autocomplete.cm-tooltip": {
|
|
1018
|
-
padding: "5px",
|
|
1019
|
-
borderRadius: "5px"
|
|
1020
|
-
},
|
|
1021
|
-
"& .cm-tooltip.cm-tooltip-autocomplete > ul > li": {
|
|
1022
|
-
borderRadius: "3px",
|
|
1023
|
-
lineHeight: 1.6
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
{ dark: config.dark }
|
|
1027
|
-
);
|
|
1028
|
-
var darkSyntaxTheme = [
|
|
1029
|
-
{ tag: t.keyword, color: config.keyword },
|
|
1030
|
-
{ tag: t.variableName, color: config.variableName },
|
|
1031
|
-
{
|
|
1032
|
-
tag: [t.name, t.deleted, t.character, t.macroName],
|
|
1033
|
-
color: config.variable
|
|
1034
|
-
},
|
|
1035
|
-
{ tag: [t.propertyName], color: config.propertyName },
|
|
1036
|
-
{
|
|
1037
|
-
tag: [t.processingInstruction, t.string, t.inserted, t.special(t.string)],
|
|
1038
|
-
color: config.string
|
|
1039
|
-
},
|
|
1040
|
-
{
|
|
1041
|
-
tag: [t.function(t.variableName), t.function(t.propertyName), t.labelName],
|
|
1042
|
-
color: config.function
|
|
1043
|
-
},
|
|
1044
|
-
{
|
|
1045
|
-
tag: [t.moduleKeyword, t.controlKeyword],
|
|
1046
|
-
color: config.moduleKeyword
|
|
1047
|
-
},
|
|
1048
|
-
{
|
|
1049
|
-
tag: [t.color, t.constant(t.name), t.standard(t.name)],
|
|
1050
|
-
color: config.constant
|
|
1051
|
-
},
|
|
1052
|
-
{ tag: t.definition(t.name), color: config.variable },
|
|
1053
|
-
{ tag: [t.className], color: config.class },
|
|
1054
|
-
{
|
|
1055
|
-
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
|
|
1056
|
-
color: config.number
|
|
1057
|
-
},
|
|
1058
|
-
{ tag: [t.typeName], color: config.type, fontStyle: config.type },
|
|
1059
|
-
{ tag: [t.operatorKeyword], color: config.keyword },
|
|
1060
|
-
{ tag: [t.url, t.escape, t.regexp, t.link], color: config.regexp },
|
|
1061
|
-
{ tag: [t.meta, t.comment], color: config.comment },
|
|
1062
|
-
{ tag: t.strong, fontWeight: "bold" },
|
|
1063
|
-
{ tag: t.emphasis, fontStyle: "italic" },
|
|
1064
|
-
{ tag: t.link, textDecoration: "underline" },
|
|
1065
|
-
{ tag: t.heading, fontWeight: "bold", color: config.heading },
|
|
1066
|
-
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: config.variable },
|
|
1067
|
-
{ tag: t.invalid, color: config.invalid },
|
|
1068
|
-
{ tag: t.strikethrough, textDecoration: "line-through" },
|
|
1069
|
-
{ tag: t.separator, color: config.separator }
|
|
1070
|
-
];
|
|
1071
|
-
|
|
1072
|
-
// src/themes/light.ts
|
|
1073
|
-
import { tags as t2 } from "@lezer/highlight";
|
|
1074
|
-
import { EditorView as EditorView3 } from "@codemirror/view";
|
|
1075
|
-
var config2 = {
|
|
1076
|
-
name: "basicLight",
|
|
1077
|
-
dark: false,
|
|
1078
|
-
background: "#f4f5f5",
|
|
1079
|
-
foreground: "#444d56",
|
|
1080
|
-
selection: "#0366d625",
|
|
1081
|
-
cursor: "#044289",
|
|
1082
|
-
dropdownBackground: "#fff",
|
|
1083
|
-
dropdownBorder: "#e1e4e8",
|
|
1084
|
-
activeLine: "#c6c6c622",
|
|
1085
|
-
matchingBracket: "#34d05840",
|
|
1086
|
-
keyword: "#d73a49",
|
|
1087
|
-
storage: "#d73a49",
|
|
1088
|
-
variable: "#e36209",
|
|
1089
|
-
parameter: "#24292e",
|
|
1090
|
-
function: "#005cc5",
|
|
1091
|
-
string: "#032f62",
|
|
1092
|
-
constant: "#005cc5",
|
|
1093
|
-
type: "#005cc5",
|
|
1094
|
-
class: "#6f42c1",
|
|
1095
|
-
number: "#005cc5",
|
|
1096
|
-
comment: "#6a737d",
|
|
1097
|
-
heading: "#005cc5",
|
|
1098
|
-
invalid: "#cb2431",
|
|
1099
|
-
regexp: "#032f62"
|
|
1100
|
-
};
|
|
1101
|
-
var lightTheme = () => EditorView3.theme(
|
|
1102
|
-
{
|
|
1103
|
-
"&": {
|
|
1104
|
-
color: config2.foreground,
|
|
1105
|
-
backgroundColor: config2.background
|
|
1106
|
-
},
|
|
1107
|
-
".cm-content": { caretColor: config2.cursor },
|
|
1108
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor: config2.cursor },
|
|
1109
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: config2.selection },
|
|
1110
|
-
".cm-panels": {
|
|
1111
|
-
backgroundColor: config2.dropdownBackground,
|
|
1112
|
-
color: config2.foreground
|
|
1113
|
-
},
|
|
1114
|
-
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1115
|
-
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1116
|
-
".cm-searchMatch": {
|
|
1117
|
-
backgroundColor: config2.dropdownBackground,
|
|
1118
|
-
outline: `1px solid ${config2.dropdownBorder}`
|
|
1119
|
-
},
|
|
1120
|
-
".cm-searchMatch.cm-searchMatch-selected": {
|
|
1121
|
-
backgroundColor: config2.selection
|
|
1122
|
-
},
|
|
1123
|
-
".cm-activeLine": { backgroundColor: config2.activeLine },
|
|
1124
|
-
".cm-selectionMatch": { backgroundColor: config2.selection },
|
|
1125
|
-
"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
|
|
1126
|
-
backgroundColor: config2.matchingBracket,
|
|
1127
|
-
outline: "none"
|
|
1128
|
-
},
|
|
1129
|
-
".cm-gutters": {
|
|
1130
|
-
backgroundColor: config2.background,
|
|
1131
|
-
color: config2.foreground,
|
|
1132
|
-
border: "none"
|
|
1133
|
-
},
|
|
1134
|
-
".cm-activeLineGutter": { backgroundColor: config2.background },
|
|
1135
|
-
".cm-foldPlaceholder": {
|
|
1136
|
-
backgroundColor: "transparent",
|
|
1137
|
-
border: "none",
|
|
1138
|
-
color: config2.foreground
|
|
1139
|
-
},
|
|
1140
|
-
".cm-tooltip": {
|
|
1141
|
-
backgroundColor: config2.dropdownBackground,
|
|
1142
|
-
color: config2.foreground,
|
|
1143
|
-
border: "none",
|
|
1144
|
-
boxShadow: "0 0 1px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .1)!important",
|
|
1145
|
-
maxWidth: "400px"
|
|
1146
|
-
},
|
|
1147
|
-
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1148
|
-
borderTopColor: "transparent",
|
|
1149
|
-
borderBottomColor: "transparent"
|
|
1150
|
-
},
|
|
1151
|
-
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1152
|
-
borderTopColor: config2.foreground,
|
|
1153
|
-
borderBottomColor: config2.foreground
|
|
1154
|
-
},
|
|
1155
|
-
".cm-tooltip-autocomplete": {
|
|
1156
|
-
"& > ul > li[aria-selected]": {
|
|
1157
|
-
background: config2.selection,
|
|
1158
|
-
color: config2.foreground
|
|
1159
|
-
}
|
|
1160
|
-
},
|
|
1161
|
-
".cm-tooltip code[class*=language-]": {
|
|
1162
|
-
whiteSpace: "pre-wrap",
|
|
1163
|
-
wordBreak: "break-word",
|
|
1164
|
-
color: "rgba(28, 31, 35, 1)"
|
|
1165
|
-
},
|
|
1166
|
-
"& .cm-scroller": {
|
|
1167
|
-
border: "1px solid transparent"
|
|
1168
|
-
},
|
|
1169
|
-
"& .cm-hover-tooltip-content": {
|
|
1170
|
-
fontSize: "12px",
|
|
1171
|
-
padding: "0 10px",
|
|
1172
|
-
width: "400px",
|
|
1173
|
-
overflow: "auto",
|
|
1174
|
-
"max-height": "calc(100% - 20px)"
|
|
1175
|
-
},
|
|
1176
|
-
"& .cm-hover-tooltip-content h1": {
|
|
1177
|
-
fontSize: "14px"
|
|
1178
|
-
},
|
|
1179
|
-
"& .cm-tooltip-autocomplete.cm-tooltip": {
|
|
1180
|
-
padding: "5px",
|
|
1181
|
-
borderRadius: "5px"
|
|
1182
|
-
},
|
|
1183
|
-
"& .cm-tooltip.cm-tooltip-autocomplete > ul > li": {
|
|
1184
|
-
borderRadius: "3px",
|
|
1185
|
-
lineHeight: 1.6
|
|
1186
|
-
}
|
|
1187
|
-
},
|
|
1188
|
-
{ dark: config2.dark }
|
|
1189
|
-
);
|
|
1190
|
-
var lightSyntaxTheme = [
|
|
1191
|
-
{ tag: t2.keyword, color: config2.keyword },
|
|
1192
|
-
{
|
|
1193
|
-
tag: [t2.name, t2.deleted, t2.character, t2.macroName],
|
|
1194
|
-
color: config2.variable
|
|
1195
|
-
},
|
|
1196
|
-
{ tag: [t2.propertyName], color: config2.function },
|
|
1197
|
-
{
|
|
1198
|
-
tag: [t2.processingInstruction, t2.string, t2.inserted, t2.special(t2.string)],
|
|
1199
|
-
color: config2.string
|
|
1200
|
-
},
|
|
1201
|
-
{ tag: [t2.function(t2.variableName), t2.labelName], color: config2.function },
|
|
1202
|
-
{
|
|
1203
|
-
tag: [t2.color, t2.constant(t2.name), t2.standard(t2.name)],
|
|
1204
|
-
color: config2.constant
|
|
1205
|
-
},
|
|
1206
|
-
{ tag: [t2.definition(t2.name), t2.separator], color: config2.variable },
|
|
1207
|
-
{ tag: [t2.className], color: config2.class },
|
|
1208
|
-
{
|
|
1209
|
-
tag: [t2.number, t2.changed, t2.annotation, t2.modifier, t2.self, t2.namespace],
|
|
1210
|
-
color: config2.number
|
|
1211
|
-
},
|
|
1212
|
-
{ tag: [t2.typeName], color: config2.type, fontStyle: config2.type },
|
|
1213
|
-
{ tag: [t2.operator, t2.operatorKeyword], color: config2.keyword },
|
|
1214
|
-
{ tag: [t2.url, t2.escape, t2.regexp, t2.link], color: config2.regexp },
|
|
1215
|
-
{ tag: [t2.meta, t2.comment], color: config2.comment },
|
|
1216
|
-
{ tag: t2.strong, fontWeight: "bold" },
|
|
1217
|
-
{ tag: t2.emphasis, fontStyle: "italic" },
|
|
1218
|
-
{ tag: t2.link, textDecoration: "underline" },
|
|
1219
|
-
{ tag: t2.heading, fontWeight: "bold", color: config2.heading },
|
|
1220
|
-
{ tag: [t2.atom, t2.bool, t2.special(t2.variableName)], color: config2.variable },
|
|
1221
|
-
{ tag: t2.invalid, color: config2.invalid },
|
|
1222
|
-
{ tag: t2.strikethrough, textDecoration: "line-through" }
|
|
1223
|
-
];
|
|
4
|
+
darkTheme,
|
|
5
|
+
darkSyntaxTheme,
|
|
6
|
+
lightTheme,
|
|
7
|
+
lightSyntaxTheme
|
|
8
|
+
} from "@coze-editor/vscode-themes";
|
|
1224
9
|
export {
|
|
1225
10
|
darkSyntaxTheme,
|
|
1226
11
|
darkTheme,
|