ensis-ui 3.0.2 → 3.0.4
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/CHANGELOG.md +17 -0
- package/dist/components/code-editor/src/RsCodeEditor.css +44 -41
- package/dist/components/code-editor/src/RsCodeEditor.d.ts +2 -0
- package/dist/components/code-editor/src/RsCodeEditor.impl.js +10 -2
- package/dist/components/code-editor/src/RsCodeEditor.js +1 -1
- package/dist/components/code-editor/src/code-editor-utils.d.ts +4 -0
- package/dist/components/dropdown/src/dropdown-utils.d.ts +2 -1
- package/dist/components/monaco-editor/src/monaco-editor-utils.d.ts +5 -1
- package/dist/components/monaco-editor/src/monaco-editor-utils.js +18 -5
- package/dist/dev/vite-codemirror-deps.js +1 -1
- package/dist/monaco/languages/types.d.ts +1 -1
- package/dist/styles.css +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
## [3.0.4] - 2026-10-26
|
|
11
|
+
|
|
12
|
+
### 新增
|
|
13
|
+
|
|
14
|
+
- `RsCodeEditor`:对外增加 `foldAll()` / `unfoldAll()`。一次折叠或展开当前文档里跨行的对象和数组。编辑器未就绪时无操作。行号旁的折叠标记仍由 `foldGutter` 控制。类型记在 `RsCodeEditorExpose`。
|
|
15
|
+
|
|
16
|
+
### 修复
|
|
17
|
+
|
|
18
|
+
- `RsCodeEditor`:根节点从带 `role="group"` 的 `div` 改为 `fieldset`。分组语义由元素本身提供,读屏仍能读到 `aria-label`。清掉浏览器默认的外边距、内边距和 `min-content` 最小宽度,边框和圆角仍走原来的 `--rs-*`。
|
|
19
|
+
|
|
20
|
+
## [3.0.3] - 2026-10-18
|
|
21
|
+
|
|
22
|
+
### 新增
|
|
23
|
+
|
|
24
|
+
- `RsMonacoEditor`:`language` 增加 `xml`。Monaco 把 `<` `>` 登记成括号,彩色括号会从起始 `<` 涂到后面的 `>`,整段标签都带底色。`xml` 关闭彩色括号、括号匹配和括号参考线,缩进参考线仍保留。Playground 与文档站的语言示例已带上 XML。
|
|
25
|
+
|
|
9
26
|
## [3.0.2] - 2026-10-18
|
|
10
27
|
|
|
11
28
|
### 修复
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
.rs-code-editor[data-v-
|
|
2
|
+
.rs-code-editor[data-v-12ff6203] {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
min-inline-size: 0;
|
|
5
8
|
overflow: hidden;
|
|
6
9
|
border: 1px solid var(--rs-border);
|
|
7
10
|
border-radius: var(--rs-radius);
|
|
8
11
|
background: var(--rs-input-bg);
|
|
9
12
|
color: var(--rs-text-primary);
|
|
10
13
|
}
|
|
11
|
-
.rs-code-editor--square[data-v-
|
|
14
|
+
.rs-code-editor--square[data-v-12ff6203] {
|
|
12
15
|
border-radius: 0;
|
|
13
16
|
}
|
|
14
|
-
.rs-code-editor--embedded[data-v-
|
|
17
|
+
.rs-code-editor--embedded[data-v-12ff6203] {
|
|
15
18
|
border: 0;
|
|
16
19
|
border-radius: 0;
|
|
17
20
|
background: transparent;
|
|
@@ -19,7 +22,7 @@
|
|
|
19
22
|
min-block-size: 0;
|
|
20
23
|
inline-size: 100%;
|
|
21
24
|
}
|
|
22
|
-
.rs-code-editor__toolbar[data-v-
|
|
25
|
+
.rs-code-editor__toolbar[data-v-12ff6203] {
|
|
23
26
|
display: flex;
|
|
24
27
|
align-items: center;
|
|
25
28
|
justify-content: space-between;
|
|
@@ -29,23 +32,23 @@
|
|
|
29
32
|
color: var(--rs-text-secondary);
|
|
30
33
|
font-size: var(--rs-font-size-xs);
|
|
31
34
|
}
|
|
32
|
-
.rs-code-editor__body[data-v-
|
|
35
|
+
.rs-code-editor__body[data-v-12ff6203] {
|
|
33
36
|
position: relative;
|
|
34
37
|
flex: 1;
|
|
35
38
|
min-block-size: 0;
|
|
36
39
|
display: flex;
|
|
37
40
|
flex-direction: column;
|
|
38
41
|
}
|
|
39
|
-
.rs-code-editor__surface[data-v-
|
|
42
|
+
.rs-code-editor__surface[data-v-12ff6203] {
|
|
40
43
|
flex: 1;
|
|
41
44
|
min-block-size: 0;
|
|
42
45
|
overflow: hidden;
|
|
43
46
|
}
|
|
44
|
-
.rs-code-editor--embedded .rs-code-editor__body[data-v-
|
|
45
|
-
.rs-code-editor--embedded .rs-code-editor__surface[data-v-
|
|
47
|
+
.rs-code-editor--embedded .rs-code-editor__body[data-v-12ff6203],
|
|
48
|
+
.rs-code-editor--embedded .rs-code-editor__surface[data-v-12ff6203] {
|
|
46
49
|
block-size: 100%;
|
|
47
50
|
}
|
|
48
|
-
.rs-code-editor__inline-edit[data-v-
|
|
51
|
+
.rs-code-editor__inline-edit[data-v-12ff6203] {
|
|
49
52
|
position: absolute;
|
|
50
53
|
z-index: var(--rs-z-dropdown);
|
|
51
54
|
inset-block-start: 12%;
|
|
@@ -58,7 +61,7 @@
|
|
|
58
61
|
background: var(--rs-surface-elevated);
|
|
59
62
|
box-shadow: var(--rs-shadow-lg);
|
|
60
63
|
}
|
|
61
|
-
.rs-code-editor__inline-edit-head[data-v-
|
|
64
|
+
.rs-code-editor__inline-edit-head[data-v-12ff6203] {
|
|
62
65
|
display: flex;
|
|
63
66
|
align-items: center;
|
|
64
67
|
justify-content: space-between;
|
|
@@ -67,7 +70,7 @@
|
|
|
67
70
|
font-weight: var(--rs-font-weight-semibold);
|
|
68
71
|
color: var(--rs-text-primary);
|
|
69
72
|
}
|
|
70
|
-
.rs-code-editor__inline-edit-head kbd[data-v-
|
|
73
|
+
.rs-code-editor__inline-edit-head kbd[data-v-12ff6203] {
|
|
71
74
|
padding-block: var(--rs-space-xs);
|
|
72
75
|
padding-inline: var(--rs-space-xs);
|
|
73
76
|
border-radius: var(--rs-radius-xs);
|
|
@@ -75,7 +78,7 @@
|
|
|
75
78
|
font-size: var(--rs-font-size-xs);
|
|
76
79
|
color: var(--rs-text-secondary);
|
|
77
80
|
}
|
|
78
|
-
.rs-code-editor__inline-preview[data-v-
|
|
81
|
+
.rs-code-editor__inline-preview[data-v-12ff6203] {
|
|
79
82
|
margin: 0;
|
|
80
83
|
margin-block-end: var(--rs-space-sm);
|
|
81
84
|
padding-block: var(--rs-space-xs);
|
|
@@ -90,7 +93,7 @@
|
|
|
90
93
|
max-block-size: 4.5rem;
|
|
91
94
|
overflow: hidden;
|
|
92
95
|
}
|
|
93
|
-
.rs-code-editor__inline-input[data-v-
|
|
96
|
+
.rs-code-editor__inline-input[data-v-12ff6203] {
|
|
94
97
|
inline-size: 100%;
|
|
95
98
|
box-sizing: border-box;
|
|
96
99
|
margin-block-end: var(--rs-space-sm);
|
|
@@ -103,24 +106,24 @@
|
|
|
103
106
|
font-size: var(--rs-font-size-sm);
|
|
104
107
|
font-family: inherit;
|
|
105
108
|
}
|
|
106
|
-
.rs-code-editor__inline-input[data-v-
|
|
107
|
-
.rs-code-editor__inline-btn[data-v-
|
|
108
|
-
.rs-code-editor__diagnostic-btn[data-v-
|
|
109
|
+
.rs-code-editor__inline-input[data-v-12ff6203]:focus-visible,
|
|
110
|
+
.rs-code-editor__inline-btn[data-v-12ff6203]:focus-visible,
|
|
111
|
+
.rs-code-editor__diagnostic-btn[data-v-12ff6203]:focus-visible {
|
|
109
112
|
outline: var(--rs-focus-ring-width) solid var(--rs-focus-ring);
|
|
110
113
|
outline-offset: 1px;
|
|
111
114
|
}
|
|
112
|
-
.rs-code-editor__inline-error[data-v-
|
|
115
|
+
.rs-code-editor__inline-error[data-v-12ff6203] {
|
|
113
116
|
margin: 0;
|
|
114
117
|
margin-block-end: var(--rs-space-sm);
|
|
115
118
|
font-size: var(--rs-font-size-xs);
|
|
116
119
|
color: var(--rs-danger);
|
|
117
120
|
}
|
|
118
|
-
.rs-code-editor__inline-actions[data-v-
|
|
121
|
+
.rs-code-editor__inline-actions[data-v-12ff6203] {
|
|
119
122
|
display: flex;
|
|
120
123
|
justify-content: flex-end;
|
|
121
124
|
gap: var(--rs-space-xs);
|
|
122
125
|
}
|
|
123
|
-
.rs-code-editor__inline-btn[data-v-
|
|
126
|
+
.rs-code-editor__inline-btn[data-v-12ff6203] {
|
|
124
127
|
padding-block: var(--rs-space-xs);
|
|
125
128
|
padding-inline: var(--rs-space-sm);
|
|
126
129
|
border: 1px solid var(--rs-border);
|
|
@@ -131,70 +134,70 @@
|
|
|
131
134
|
font-family: inherit;
|
|
132
135
|
cursor: pointer;
|
|
133
136
|
}
|
|
134
|
-
.rs-code-editor__inline-btn--primary[data-v-
|
|
137
|
+
.rs-code-editor__inline-btn--primary[data-v-12ff6203] {
|
|
135
138
|
border-color: var(--rs-primary);
|
|
136
139
|
background: var(--rs-primary);
|
|
137
140
|
color: var(--rs-primary-foreground);
|
|
138
141
|
}
|
|
139
|
-
.rs-code-editor__inline-btn[data-v-
|
|
142
|
+
.rs-code-editor__inline-btn[data-v-12ff6203]:disabled {
|
|
140
143
|
opacity: 0.55;
|
|
141
144
|
cursor: not-allowed;
|
|
142
145
|
}
|
|
143
|
-
.rs-code-editor__surface--disabled[data-v-
|
|
146
|
+
.rs-code-editor__surface--disabled[data-v-12ff6203] {
|
|
144
147
|
opacity: 0.6;
|
|
145
148
|
pointer-events: none;
|
|
146
149
|
}
|
|
147
|
-
.rs-code-editor__surface[data-v-
|
|
150
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-editor {
|
|
148
151
|
/* CodeMirror 自己写 height / width / border-right,逻辑属性盖不住。 */
|
|
149
152
|
height: 100%;
|
|
150
153
|
background: var(--rs-surface-elevated) !important;
|
|
151
154
|
}
|
|
152
|
-
.rs-code-editor__surface[data-v-
|
|
155
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-scroller {
|
|
153
156
|
font-family: var(--rs-code-font-family, var(--rs-font-mono));
|
|
154
157
|
font-size: var(--rs-code-font-size, var(--rs-font-size-sm));
|
|
155
158
|
line-height: var(--rs-code-line-height, var(--rs-line-height-relaxed));
|
|
156
159
|
}
|
|
157
|
-
.rs-code-editor__surface[data-v-
|
|
160
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-gutters {
|
|
158
161
|
background: color-mix(in srgb, var(--rs-surface-elevated) 85%, var(--rs-border) 15%) !important;
|
|
159
162
|
border-right-color: var(--rs-border-subtle) !important;
|
|
160
163
|
color: var(--rs-text-secondary);
|
|
161
164
|
}
|
|
162
|
-
.rs-code-editor--embedded .rs-code-editor__surface[data-v-
|
|
165
|
+
.rs-code-editor--embedded .rs-code-editor__surface[data-v-12ff6203] .cm-editor {
|
|
163
166
|
height: 100%;
|
|
164
167
|
background: transparent !important;
|
|
165
168
|
}
|
|
166
|
-
.rs-code-editor--no-fold .rs-code-editor__surface[data-v-
|
|
169
|
+
.rs-code-editor--no-fold .rs-code-editor__surface[data-v-12ff6203] .cm-foldGutter {
|
|
167
170
|
display: none !important;
|
|
168
171
|
width: 0 !important;
|
|
169
172
|
min-width: 0 !important;
|
|
170
173
|
}
|
|
171
|
-
.rs-code-editor--gutter-fixed .rs-code-editor__surface[data-v-
|
|
174
|
+
.rs-code-editor--gutter-fixed .rs-code-editor__surface[data-v-12ff6203] .cm-gutters {
|
|
172
175
|
min-width: var(--rs-code-editor-gutter-width);
|
|
173
176
|
}
|
|
174
|
-
.rs-code-editor--gutter-fixed.rs-code-editor--no-fold .rs-code-editor__surface[data-v-
|
|
177
|
+
.rs-code-editor--gutter-fixed.rs-code-editor--no-fold .rs-code-editor__surface[data-v-12ff6203] .cm-lineNumbers {
|
|
175
178
|
min-width: var(--rs-code-editor-gutter-width);
|
|
176
179
|
}
|
|
177
|
-
.rs-code-editor--gutter-fixed.rs-code-editor--no-fold .rs-code-editor__surface[data-v-
|
|
180
|
+
.rs-code-editor--gutter-fixed.rs-code-editor--no-fold .rs-code-editor__surface[data-v-12ff6203] .cm-lineNumbers .cm-gutterElement {
|
|
178
181
|
min-width: calc(var(--rs-code-editor-gutter-width) - var(--rs-space-sm));
|
|
179
182
|
}
|
|
180
|
-
.rs-code-editor__surface[data-v-
|
|
183
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-content {
|
|
181
184
|
color: var(--rs-text-primary);
|
|
182
185
|
}
|
|
183
|
-
.rs-code-editor__surface[data-v-
|
|
186
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-lintRange-error {
|
|
184
187
|
background: color-mix(in srgb, var(--rs-danger) 12%, transparent);
|
|
185
188
|
}
|
|
186
|
-
.rs-code-editor__surface[data-v-
|
|
189
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-lintRange-warning {
|
|
187
190
|
background: color-mix(in srgb, var(--rs-warning) 12%, transparent);
|
|
188
191
|
}
|
|
189
|
-
.rs-code-editor__surface[data-v-
|
|
192
|
+
.rs-code-editor__surface[data-v-12ff6203] .cm-lintRange-info {
|
|
190
193
|
background: color-mix(in srgb, var(--rs-info) 10%, transparent);
|
|
191
194
|
}
|
|
192
|
-
.rs-code-editor__surface[data-v-
|
|
195
|
+
.rs-code-editor__surface[data-v-12ff6203] .rs-code-editor__ghost {
|
|
193
196
|
color: var(--rs-text-secondary);
|
|
194
197
|
opacity: 0.55;
|
|
195
198
|
pointer-events: none;
|
|
196
199
|
}
|
|
197
|
-
.rs-code-editor__surface[data-v-
|
|
200
|
+
.rs-code-editor__surface[data-v-12ff6203] .rs-code-editor__hover {
|
|
198
201
|
max-inline-size: var(--rs-code-editor-inline-width);
|
|
199
202
|
padding-block: var(--rs-space-sm);
|
|
200
203
|
padding-inline: var(--rs-space-sm);
|
|
@@ -208,7 +211,7 @@
|
|
|
208
211
|
white-space: pre-wrap;
|
|
209
212
|
box-shadow: var(--rs-shadow);
|
|
210
213
|
}
|
|
211
|
-
.rs-code-editor__diagnostics[data-v-
|
|
214
|
+
.rs-code-editor__diagnostics[data-v-12ff6203] {
|
|
212
215
|
margin: 0;
|
|
213
216
|
padding-block: var(--rs-space-sm);
|
|
214
217
|
padding-inline: var(--rs-space-md);
|
|
@@ -217,7 +220,7 @@
|
|
|
217
220
|
font-size: var(--rs-font-size-xs);
|
|
218
221
|
list-style: none;
|
|
219
222
|
}
|
|
220
|
-
.rs-code-editor__diagnostic-btn[data-v-
|
|
223
|
+
.rs-code-editor__diagnostic-btn[data-v-12ff6203] {
|
|
221
224
|
display: block;
|
|
222
225
|
inline-size: 100%;
|
|
223
226
|
margin: 0;
|
|
@@ -229,12 +232,12 @@
|
|
|
229
232
|
text-align: start;
|
|
230
233
|
cursor: pointer;
|
|
231
234
|
}
|
|
232
|
-
.rs-code-editor__diagnostic--error[data-v-
|
|
235
|
+
.rs-code-editor__diagnostic--error[data-v-12ff6203] {
|
|
233
236
|
color: var(--rs-danger);
|
|
234
237
|
}
|
|
235
|
-
.rs-code-editor__diagnostic--warning[data-v-
|
|
238
|
+
.rs-code-editor__diagnostic--warning[data-v-12ff6203] {
|
|
236
239
|
color: var(--rs-warning);
|
|
237
240
|
}
|
|
238
|
-
.rs-code-editor__diagnostic--info[data-v-
|
|
241
|
+
.rs-code-editor__diagnostic--info[data-v-12ff6203] {
|
|
239
242
|
color: var(--rs-info);
|
|
240
243
|
}
|
|
@@ -60,6 +60,8 @@ type __VLS_Slots = {} & {
|
|
|
60
60
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
61
61
|
goToPosition(line: number, column?: number): void;
|
|
62
62
|
focus(): void;
|
|
63
|
+
foldAll(): void;
|
|
64
|
+
unfoldAll(): void;
|
|
63
65
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
64
66
|
"update:modelValue": (value: string) => any;
|
|
65
67
|
ready: () => any;
|
|
@@ -11,6 +11,7 @@ import { Fragment, computed, createCommentVNode, createElementBlock, createEleme
|
|
|
11
11
|
import { basicSetup } from "codemirror";
|
|
12
12
|
import { Compartment, EditorState } from "@codemirror/state";
|
|
13
13
|
import { EditorView, placeholder, tooltips } from "@codemirror/view";
|
|
14
|
+
import { foldAll, unfoldAll } from "@codemirror/language";
|
|
14
15
|
import { oneDark } from "@codemirror/theme-one-dark";
|
|
15
16
|
//#region src/components/code-editor/src/RsCodeEditor.vue?vue&type=script&setup=true&lang.ts
|
|
16
17
|
var _hoisted_1 = [
|
|
@@ -405,10 +406,18 @@ var RsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
405
406
|
focus() {
|
|
406
407
|
if (!isEditorViewAlive(view.value) || props.disabled) return;
|
|
407
408
|
view.value.focus();
|
|
409
|
+
},
|
|
410
|
+
foldAll() {
|
|
411
|
+
if (!isEditorViewAlive(view.value)) return;
|
|
412
|
+
foldAll(view.value);
|
|
413
|
+
},
|
|
414
|
+
unfoldAll() {
|
|
415
|
+
if (!isEditorViewAlive(view.value)) return;
|
|
416
|
+
unfoldAll(view.value);
|
|
408
417
|
}
|
|
409
418
|
});
|
|
410
419
|
return (_ctx, _cache) => {
|
|
411
|
-
return openBlock(), createElementBlock("
|
|
420
|
+
return openBlock(), createElementBlock("fieldset", {
|
|
412
421
|
id: __props.id,
|
|
413
422
|
class: normalizeClass(["rs-code-editor", [`rs-code-editor--${resolvedTheme.value}`, {
|
|
414
423
|
"rs-code-editor--embedded": __props.embedded,
|
|
@@ -418,7 +427,6 @@ var RsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
418
427
|
}]]),
|
|
419
428
|
style: normalizeStyle(rootStyle.value),
|
|
420
429
|
"data-rs-theme": themeIsland.value,
|
|
421
|
-
role: "group",
|
|
422
430
|
"aria-label": editorLabel.value,
|
|
423
431
|
"aria-disabled": __props.disabled ? "true" : void 0
|
|
424
432
|
}, [
|
|
@@ -3,6 +3,6 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
|
|
|
3
3
|
import RsCodeEditor_vue_vue_type_script_setup_true_lang_default from "./RsCodeEditor.impl.js";
|
|
4
4
|
|
|
5
5
|
//#region src/components/code-editor/src/RsCodeEditor.vue
|
|
6
|
-
var RsCodeEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(RsCodeEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
6
|
+
var RsCodeEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(RsCodeEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-12ff6203"]]);
|
|
7
7
|
//#endregion
|
|
8
8
|
export { RsCodeEditor_default as default };
|
|
@@ -44,5 +44,9 @@ export interface RsCodeEditorExpose {
|
|
|
44
44
|
goToPosition: (line: number, column?: number) => void;
|
|
45
45
|
/** 聚焦编辑区。禁用或未就绪时无操作。 */
|
|
46
46
|
focus: () => void;
|
|
47
|
+
/** 折叠当前文档里所有可折叠范围。编辑器未就绪时无操作。 */
|
|
48
|
+
foldAll: () => void;
|
|
49
|
+
/** 展开当前文档里所有已折叠范围。编辑器未就绪时无操作。 */
|
|
50
|
+
unfoldAll: () => void;
|
|
47
51
|
}
|
|
48
52
|
export {};
|
|
@@ -21,7 +21,8 @@ export interface RsDropdownItemGroup {
|
|
|
21
21
|
label: string;
|
|
22
22
|
options: RsDropdownItem[];
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
/** 同一菜单可以混放单项和分组。 */
|
|
25
|
+
export type RsDropdownItems = Array<RsDropdownItem | RsDropdownItemGroup>;
|
|
25
26
|
/** 菜单宽度:trigger 对齐触发器;fit 随内容,不跟窄图标按钮 */
|
|
26
27
|
export type RsDropdownContentWidth = 'trigger' | 'fit';
|
|
27
28
|
export type RsDropdownTrigger = 'click' | 'hover' | 'contextmenu';
|
|
@@ -74,7 +74,10 @@ export declare function completionReplaceRange(lineNumber: number, column: numbe
|
|
|
74
74
|
startColumn: number;
|
|
75
75
|
endColumn: number;
|
|
76
76
|
};
|
|
77
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* 合并业务侧 options;suggest 做一层浅合并,避免整对象覆盖默认。
|
|
79
|
+
* XML 的内置括号是 `<` `>`,彩色括号会把标签之间整段涂色,这里关掉。
|
|
80
|
+
*/
|
|
78
81
|
export declare function mergeMonacoEditorOptions(overrides: Record<string, unknown> | undefined, language: string | undefined): Record<string, unknown>;
|
|
79
82
|
export declare function prefersReducedMotion(): boolean;
|
|
80
83
|
export declare function monacoMotionOptions(reduced: boolean): {
|
|
@@ -89,6 +92,7 @@ declare const THEME_COLOR_IDS: {
|
|
|
89
92
|
readonly gutter: "editorGutter.background";
|
|
90
93
|
readonly gutterForeground: "editorLineNumber.foreground";
|
|
91
94
|
readonly lineHighlight: "editor.lineHighlightBackground";
|
|
95
|
+
readonly placeholder: "editor.placeholder.foreground";
|
|
92
96
|
readonly selection: "editor.selectionBackground";
|
|
93
97
|
readonly widget: "editorWidget.background";
|
|
94
98
|
readonly widgetBorder: "editorWidget.border";
|
|
@@ -23,6 +23,7 @@ var SNIPPET_LANGUAGES = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"plaintext",
|
|
24
24
|
"sql",
|
|
25
25
|
"yaml",
|
|
26
|
+
"xml",
|
|
26
27
|
"json"
|
|
27
28
|
]);
|
|
28
29
|
/** Bridge LSP 接管补全;勿再注册实例级 Provider。 */
|
|
@@ -72,16 +73,26 @@ function completionReplaceRange(lineNumber, column, prefix) {
|
|
|
72
73
|
endColumn: safeColumn
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* 合并业务侧 options;suggest 做一层浅合并,避免整对象覆盖默认。
|
|
78
|
+
* XML 的内置括号是 `<` `>`,彩色括号会把标签之间整段涂色,这里关掉。
|
|
79
|
+
*/
|
|
76
80
|
function mergeMonacoEditorOptions(overrides, language) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (overrides.suggest && typeof overrides.suggest === "object" && !Array.isArray(overrides.suggest)) out.suggest = {
|
|
81
|
+
const out = overrides ? { ...overrides } : {};
|
|
82
|
+
if (overrides?.suggest && typeof overrides.suggest === "object" && !Array.isArray(overrides.suggest)) out.suggest = {
|
|
80
83
|
snippetsPreventQuickSuggestions: false,
|
|
81
84
|
filterGraceful: !isManagedSqlDialect(language),
|
|
82
85
|
matchOnWordStartOnly: isManagedSqlDialect(language),
|
|
83
86
|
...overrides.suggest
|
|
84
87
|
};
|
|
88
|
+
if (language !== "xml") return overrides ? out : {};
|
|
89
|
+
const guides = out.guides && typeof out.guides === "object" && !Array.isArray(out.guides) ? { ...out.guides } : {};
|
|
90
|
+
guides.bracketPairs = false;
|
|
91
|
+
guides.bracketPairsHorizontal = false;
|
|
92
|
+
guides.highlightActiveBracketPair = false;
|
|
93
|
+
out.guides = guides;
|
|
94
|
+
out.bracketPairColorization = { enabled: false };
|
|
95
|
+
out.matchBrackets = "never";
|
|
85
96
|
return out;
|
|
86
97
|
}
|
|
87
98
|
function prefersReducedMotion() {
|
|
@@ -142,6 +153,7 @@ var THEME_COLOR_IDS = {
|
|
|
142
153
|
gutter: "editorGutter.background",
|
|
143
154
|
gutterForeground: "editorLineNumber.foreground",
|
|
144
155
|
lineHighlight: "editor.lineHighlightBackground",
|
|
156
|
+
placeholder: "editor.placeholder.foreground",
|
|
145
157
|
selection: "editor.selectionBackground",
|
|
146
158
|
widget: "editorWidget.background",
|
|
147
159
|
widgetBorder: "editorWidget.border"
|
|
@@ -161,7 +173,8 @@ function readMonacoThemeColors(el) {
|
|
|
161
173
|
foreground: pick("--rs-monaco-fg", "--rs-text-primary"),
|
|
162
174
|
gutter: pick("--rs-monaco-gutter", "--rs-surface"),
|
|
163
175
|
gutterForeground: pick("--rs-monaco-gutter-fg", "--rs-text-tertiary"),
|
|
164
|
-
lineHighlight: pick("--rs-monaco-line-highlight", "--rs-
|
|
176
|
+
lineHighlight: pick("--rs-monaco-line-highlight", "--rs-item-hover"),
|
|
177
|
+
placeholder: pick("--rs-monaco-placeholder", "--rs-placeholder"),
|
|
165
178
|
selection: pick("--rs-monaco-selection", "--rs-primary-container"),
|
|
166
179
|
widget: pick("--rs-monaco-widget-bg", "--rs-surface-elevated"),
|
|
167
180
|
widgetBorder: pick("--rs-monaco-widget-border", "--rs-border")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "codemirror";
|
|
2
|
+
import "@codemirror/language";
|
|
2
3
|
import "@codemirror/lang-cpp";
|
|
3
4
|
import "@codemirror/lang-css";
|
|
4
5
|
import "@codemirror/lang-go";
|
|
@@ -12,5 +13,4 @@ import "@codemirror/lang-rust";
|
|
|
12
13
|
import "@codemirror/lang-sql";
|
|
13
14
|
import "@codemirror/lang-xml";
|
|
14
15
|
import "@codemirror/lang-yaml";
|
|
15
|
-
import "@codemirror/language";
|
|
16
16
|
import "@codemirror/legacy-modes/mode/shell";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Monaco 内置语言与扩展方言 ID。后续 SQL / YAML 方言在 languages/ 下新增并在此登记。 */
|
|
2
|
-
export type MonacoBuiltinLanguage = 'json' | 'javascript' | 'typescript' | 'sql' | 'yaml' | 'plaintext';
|
|
2
|
+
export type MonacoBuiltinLanguage = 'json' | 'javascript' | 'typescript' | 'sql' | 'yaml' | 'xml' | 'plaintext';
|
|
3
3
|
/** SQL 方言 languageId(业务侧注册:Worker 或 Bridge LSP)。
|
|
4
4
|
* 新增方言时在此扩展;Worker 方言另在 setupMonacoWorkers 挂对应 worker。
|
|
5
5
|
*/
|
package/dist/styles.css
CHANGED
|
@@ -577,7 +577,9 @@ html {
|
|
|
577
577
|
--rs-monaco-fg: var(--rs-text-primary);
|
|
578
578
|
--rs-monaco-gutter: var(--rs-surface);
|
|
579
579
|
--rs-monaco-gutter-fg: var(--rs-text-tertiary);
|
|
580
|
-
|
|
580
|
+
/* 当前行跟条目悬停,不用按钮用的实色 surface-hover,避免空编辑器占位变成一条灰带 */
|
|
581
|
+
--rs-monaco-line-highlight: var(--rs-item-hover);
|
|
582
|
+
--rs-monaco-placeholder: var(--rs-placeholder);
|
|
581
583
|
--rs-monaco-selection: var(--rs-primary-container);
|
|
582
584
|
--rs-monaco-widget-bg: var(--rs-surface-elevated);
|
|
583
585
|
--rs-monaco-widget-border: var(--rs-border);
|