ensis-ui 3.0.3 → 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 CHANGED
@@ -6,6 +6,17 @@
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
+
9
20
  ## [3.0.3] - 2026-10-18
10
21
 
11
22
  ### 新增
@@ -1,17 +1,20 @@
1
1
 
2
- .rs-code-editor[data-v-3ab77c7a] {
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-3ab77c7a] {
14
+ .rs-code-editor--square[data-v-12ff6203] {
12
15
  border-radius: 0;
13
16
  }
14
- .rs-code-editor--embedded[data-v-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a],
45
- .rs-code-editor--embedded .rs-code-editor__surface[data-v-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a]:focus-visible,
107
- .rs-code-editor__inline-btn[data-v-3ab77c7a]:focus-visible,
108
- .rs-code-editor__diagnostic-btn[data-v-3ab77c7a]:focus-visible {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a]:disabled {
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-3ab77c7a] {
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-3ab77c7a] .cm-editor {
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-3ab77c7a] .cm-scroller {
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-3ab77c7a] .cm-gutters {
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-3ab77c7a] .cm-editor {
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-3ab77c7a] .cm-foldGutter {
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-3ab77c7a] .cm-gutters {
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-3ab77c7a] .cm-lineNumbers {
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-3ab77c7a] .cm-lineNumbers .cm-gutterElement {
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-3ab77c7a] .cm-content {
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-3ab77c7a] .cm-lintRange-error {
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-3ab77c7a] .cm-lintRange-warning {
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-3ab77c7a] .cm-lintRange-info {
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-3ab77c7a] .rs-code-editor__ghost {
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-3ab77c7a] .rs-code-editor__hover {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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-3ab77c7a] {
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("div", {
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-3ab77c7a"]]);
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
- export type RsDropdownItems = RsDropdownItem[] | RsDropdownItemGroup[];
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';
@@ -92,6 +92,7 @@ declare const THEME_COLOR_IDS: {
92
92
  readonly gutter: "editorGutter.background";
93
93
  readonly gutterForeground: "editorLineNumber.foreground";
94
94
  readonly lineHighlight: "editor.lineHighlightBackground";
95
+ readonly placeholder: "editor.placeholder.foreground";
95
96
  readonly selection: "editor.selectionBackground";
96
97
  readonly widget: "editorWidget.background";
97
98
  readonly widgetBorder: "editorWidget.border";
@@ -153,6 +153,7 @@ var THEME_COLOR_IDS = {
153
153
  gutter: "editorGutter.background",
154
154
  gutterForeground: "editorLineNumber.foreground",
155
155
  lineHighlight: "editor.lineHighlightBackground",
156
+ placeholder: "editor.placeholder.foreground",
156
157
  selection: "editor.selectionBackground",
157
158
  widget: "editorWidget.background",
158
159
  widgetBorder: "editorWidget.border"
@@ -172,7 +173,8 @@ function readMonacoThemeColors(el) {
172
173
  foreground: pick("--rs-monaco-fg", "--rs-text-primary"),
173
174
  gutter: pick("--rs-monaco-gutter", "--rs-surface"),
174
175
  gutterForeground: pick("--rs-monaco-gutter-fg", "--rs-text-tertiary"),
175
- lineHighlight: pick("--rs-monaco-line-highlight", "--rs-surface-hover"),
176
+ lineHighlight: pick("--rs-monaco-line-highlight", "--rs-item-hover"),
177
+ placeholder: pick("--rs-monaco-placeholder", "--rs-placeholder"),
176
178
  selection: pick("--rs-monaco-selection", "--rs-primary-container"),
177
179
  widget: pick("--rs-monaco-widget-bg", "--rs-surface-elevated"),
178
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";
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
- --rs-monaco-line-highlight: var(--rs-surface-hover);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ensis-ui",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Vue 3 workbench design system — Rs* components, --rs-* tokens, optional Monaco / CodeMirror / xterm",