@knime/kds-code-editor 6.7.1 → 6.8.0

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
@@ -1,5 +1,28 @@
1
1
  # @knime/kds-code-editor
2
2
 
3
+ ## 6.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - de14193: - `KdsCodeEditor`:
8
+ - added `highlighted` prop — keeps the focus highlight on while the code area
9
+ is not focused and marks the editor as the current one via `aria-current`,
10
+ for lists of editors where one stays the target of outside actions after the
11
+ focus has moved on. At most one editor of a list may set it; enforcing that
12
+ is the caller's job.
13
+ - added `preserveSubTextSpace` prop — reserves the sub-text line while no
14
+ `subText` is shown, preventing layout shifts when a validation message
15
+ appears or disappears.
16
+ - `KdsCodeDiffEditor`: added `preserveSubTextSpace` prop — reserves the
17
+ sub-text line while no `subText` is shown, preventing layout shifts when a
18
+ validation message appears or disappears.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [de14193]
23
+ - @knime/kds-components@6.8.0
24
+ - @knime/kds-styles@6.8.0
25
+
3
26
  ## 6.7.1
4
27
 
5
28
  ### Patch Changes
package/dist/index.css CHANGED
@@ -1,13 +1,13 @@
1
1
 
2
2
  .kds-code-editor {
3
- &[data-v-81449d1b] {
3
+ &[data-v-03dd8fb6] {
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
 
7
7
  /* No row bounds set: fill the width and height of the container. */
8
8
  }
9
9
  .editor {
10
- &[data-v-81449d1b] {
10
+ &[data-v-03dd8fb6] {
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  overflow: hidden;
@@ -15,18 +15,19 @@
15
15
  border: var(--kds-border-base-subtle);
16
16
  border-radius: var(--kds-border-radius-container-0-50x);
17
17
 
18
- /* Only outline the whole editor when the code area (Monaco) is focused —
19
- header buttons keep their own focus ring. */
18
+ /* Outline the whole editor while the code area (Monaco) is focused, or
19
+ while the owning component keeps the highlight on without it — header
20
+ buttons keep their own focus ring either way. */
20
21
 
21
22
  /* Keeps its natural height — in fill mode only the code area grows /
22
23
  shrinks with the container. */
23
24
  }
24
- &.focused[data-v-81449d1b] {
25
+ &.focused[data-v-03dd8fb6] {
25
26
  outline: var(--kds-border-action-focused);
26
27
  outline-offset: var(--kds-spacing-offset-focus);
27
28
  }
28
29
  .header {
29
- &[data-v-81449d1b] {
30
+ &[data-v-03dd8fb6] {
30
31
  display: flex;
31
32
  align-items: center;
32
33
  justify-content: space-between;
@@ -36,7 +37,7 @@
36
37
 
37
38
  /* Visually hidden, still announced by screen readers. */
38
39
  }
39
- .left-block[data-v-81449d1b] {
40
+ .left-block[data-v-03dd8fb6] {
40
41
  display: flex;
41
42
  flex: 1;
42
43
  gap: var(--kds-spacing-container-0-25x);
@@ -47,13 +48,13 @@
47
48
  buttons are present (matches the small button height). */
48
49
  min-height: var(--kds-dimension-component-height-1-5x);
49
50
  }
50
- .action-buttons[data-v-81449d1b] {
51
+ .action-buttons[data-v-03dd8fb6] {
51
52
  display: flex;
52
53
  flex-shrink: 0;
53
54
  gap: var(--kds-spacing-container-0-12x);
54
55
  align-items: center;
55
56
  }
56
- .title[data-v-81449d1b] {
57
+ .title[data-v-03dd8fb6] {
57
58
  overflow: hidden;
58
59
  text-overflow: ellipsis;
59
60
  font: var(--kds-font-base-interactive-small);
@@ -61,7 +62,7 @@
61
62
  white-space: nowrap;
62
63
  }
63
64
  .change-counts {
64
- &[data-v-81449d1b] {
65
+ &[data-v-03dd8fb6] {
65
66
  display: flex;
66
67
  flex-shrink: 0;
67
68
  gap: var(--kds-spacing-container-0-12x);
@@ -72,14 +73,14 @@
72
73
  margin-left: var(--kds-spacing-container-0-25x);
73
74
  font: var(--kds-font-base-interactive-small);
74
75
  }
75
- .added-lines[data-v-81449d1b] {
76
+ .added-lines[data-v-03dd8fb6] {
76
77
  color: var(--kds-color-text-and-icon-success);
77
78
  }
78
- .removed-lines[data-v-81449d1b] {
79
+ .removed-lines[data-v-03dd8fb6] {
79
80
  color: var(--kds-color-text-and-icon-danger);
80
81
  }
81
82
  }
82
- .change-counts-for-screen-readers[data-v-81449d1b] {
83
+ .change-counts-for-screen-readers[data-v-03dd8fb6] {
83
84
  position: absolute;
84
85
  width: 1px;
85
86
  height: 1px;
@@ -91,33 +92,33 @@
91
92
  clip-path: inset(50%);
92
93
  }
93
94
  }
94
- &.error .header[data-v-81449d1b] {
95
+ &.error .header[data-v-03dd8fb6] {
95
96
  background-color: var(--kds-color-background-static-danger-muted);
96
97
  }
97
- &.warning .header[data-v-81449d1b] {
98
+ &.warning .header[data-v-03dd8fb6] {
98
99
  background-color: var(--kds-color-background-static-warning-muted);
99
100
  }
100
- .code[data-v-81449d1b] {
101
+ .code[data-v-03dd8fb6] {
101
102
  width: 100%;
102
103
  }
103
- .footer[data-v-81449d1b] {
104
+ .footer[data-v-03dd8fb6] {
104
105
  flex-shrink: 0;
105
106
  width: 100%;
106
107
  }
107
108
  }
108
109
  &.fill {
109
- &[data-v-81449d1b] {
110
+ &[data-v-03dd8fb6] {
110
111
  width: 100%;
111
112
  height: 100%;
112
113
 
113
114
  /* A collapsed editor keeps its header height instead of stretching. */
114
115
  }
115
- .editor[data-v-81449d1b],
116
- .code[data-v-81449d1b] {
116
+ .editor[data-v-03dd8fb6],
117
+ .code[data-v-03dd8fb6] {
117
118
  flex: 1 1 auto;
118
119
  min-height: 0;
119
120
  }
120
- .editor.collapsed[data-v-81449d1b] {
121
+ .editor.collapsed[data-v-03dd8fb6] {
121
122
  flex: 0 0 auto;
122
123
  }
123
124
  }
package/dist/index.js CHANGED
@@ -52,6 +52,10 @@ var BaseCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
52
52
  default: false
53
53
  },
54
54
  subText: { default: () => void 0 },
55
+ preserveSubTextSpace: {
56
+ type: Boolean,
57
+ default: false
58
+ },
55
59
  copyable: {
56
60
  type: Boolean,
57
61
  default: true
@@ -62,7 +66,7 @@ var BaseCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
62
66
  },
63
67
  copyButtonAriaLabel: { default: "" },
64
68
  editorActions: { default: () => void 0 },
65
- focused: {
69
+ showFocusHighlight: {
66
70
  type: Boolean,
67
71
  default: false
68
72
  },
@@ -92,7 +96,7 @@ getCodeContainer: () => codeContainer.value });
92
96
  "editor",
93
97
  __props.state,
94
98
  {
95
- focused: __props.focused,
99
+ focused: __props.showFocusHighlight,
96
100
  collapsed: __props.collapsed
97
101
  }
98
102
  ]) }, [
@@ -146,18 +150,19 @@ getCodeContainer: () => codeContainer.value });
146
150
  style: normalizeStyle(__props.codeHeight ? { height: __props.codeHeight } : void 0)
147
151
  }, null, 12, _hoisted_10), [[vShow, !__props.collapsed]]),
148
152
  _ctx.$slots.footer ? withDirectives((openBlock(), createElementBlock("div", _hoisted_11, [renderSlot(_ctx.$slots, "footer", {}, void 0, true)], 512)), [[vShow, !__props.collapsed]]) : createCommentVNode("", true)
149
- ], 2), __props.subText ? (openBlock(), createBlock(unref(KdsSubText), {
150
- key: 0,
153
+ ], 2), createVNode(unref(KdsSubText), {
151
154
  id: __props.subTextId,
152
155
  "sub-text": __props.subText,
156
+ "preserve-sub-text-space": __props.preserveSubTextSpace,
153
157
  error: __props.state === unref(kdsCodeEditorState).ERROR,
154
158
  warning: __props.state === unref(kdsCodeEditorState).WARNING
155
159
  }, null, 8, [
156
160
  "id",
157
161
  "sub-text",
162
+ "preserve-sub-text-space",
158
163
  "error",
159
164
  "warning"
160
- ])) : createCommentVNode("", true)], 2);
165
+ ])], 2);
161
166
  };
162
167
  }
163
168
  });
@@ -170,7 +175,7 @@ var _plugin_vue_export_helper_default = (sfc, props) => {
170
175
  };
171
176
  //#endregion
172
177
  //#region src/_helper/BaseCodeEditor.vue
173
- var BaseCodeEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(BaseCodeEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-81449d1b"]]);
178
+ var BaseCodeEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(BaseCodeEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-03dd8fb6"]]);
174
179
  //#endregion
175
180
  //#region ../styles/dist/tokens/ts/color.js
176
181
  /**
@@ -5725,7 +5730,15 @@ var KdsCodeEditor_default = /* @__PURE__ */ defineComponent({
5725
5730
  type: Boolean,
5726
5731
  default: false
5727
5732
  },
5733
+ highlighted: {
5734
+ type: Boolean,
5735
+ default: false
5736
+ },
5728
5737
  subText: { default: () => void 0 },
5738
+ preserveSubTextSpace: {
5739
+ type: Boolean,
5740
+ default: false
5741
+ },
5729
5742
  copyable: {
5730
5743
  type: Boolean,
5731
5744
  default: true
@@ -5746,6 +5759,7 @@ var KdsCodeEditor_default = /* @__PURE__ */ defineComponent({
5746
5759
  let editorInstance;
5747
5760
  let overflowWidgetsDomNode;
5748
5761
  const isEditorFocused = ref(false);
5762
+ const showFocusHighlight = computed(() => isEditorFocused.value || __props.highlighted);
5749
5763
  const headerLabel = computed(() => __props.languageLabel ?? __props.language.toUpperCase());
5750
5764
  const editorAriaLabel = computed(() => `${headerLabel.value} code editor${__props.readOnly ? ", read-only" : ""}. Press Escape followed by Tab to move focus out of the editor.`);
5751
5765
  const fillContainer = computed(() => __props.minRows === void 0 && __props.maxRows === void 0);
@@ -5767,8 +5781,14 @@ var KdsCodeEditor_default = /* @__PURE__ */ defineComponent({
5767
5781
  else input.removeAttribute("aria-describedby");
5768
5782
  if (__props.state === kdsCodeEditorState.ERROR) input.setAttribute("aria-invalid", "true");
5769
5783
  else input.removeAttribute("aria-invalid");
5784
+ if (__props.highlighted) input.setAttribute("aria-current", "true");
5785
+ else input.removeAttribute("aria-current");
5770
5786
  };
5771
- watch([() => __props.subText, () => __props.state], syncEditorInputAria);
5787
+ watch([
5788
+ () => __props.subText,
5789
+ () => __props.state,
5790
+ () => __props.highlighted
5791
+ ], syncEditorInputAria);
5772
5792
  const { copy, copied } = useClipboard({ copiedDuring: 2e3 });
5773
5793
  const copyButtonAriaLabel = computed(() => copied.value ? `Copied ${headerLabel.value} to clipboard` : `Copy ${headerLabel.value} to clipboard`);
5774
5794
  const copyToClipboard = () => {
@@ -5846,11 +5866,12 @@ getEditor: () => editorInstance });
5846
5866
  state: __props.state,
5847
5867
  "read-only": __props.readOnly,
5848
5868
  "sub-text": __props.subText,
5869
+ "preserve-sub-text-space": __props.preserveSubTextSpace,
5849
5870
  copyable: __props.copyable,
5850
5871
  copied: unref(copied),
5851
5872
  "copy-button-aria-label": copyButtonAriaLabel.value,
5852
5873
  "editor-actions": __props.editorActions,
5853
- focused: isEditorFocused.value,
5874
+ "show-focus-highlight": showFocusHighlight.value,
5854
5875
  fill: fillContainer.value,
5855
5876
  "code-height": editorHeight.value,
5856
5877
  onCopy: copyToClipboard
@@ -5865,11 +5886,12 @@ getEditor: () => editorInstance });
5865
5886
  "state",
5866
5887
  "read-only",
5867
5888
  "sub-text",
5889
+ "preserve-sub-text-space",
5868
5890
  "copyable",
5869
5891
  "copied",
5870
5892
  "copy-button-aria-label",
5871
5893
  "editor-actions",
5872
- "focused",
5894
+ "show-focus-highlight",
5873
5895
  "fill",
5874
5896
  "code-height"
5875
5897
  ]);
@@ -5905,6 +5927,10 @@ var KdsCodeDiffEditor_default = /* @__PURE__ */ defineComponent({
5905
5927
  default: false
5906
5928
  },
5907
5929
  subText: { default: () => void 0 },
5930
+ preserveSubTextSpace: {
5931
+ type: Boolean,
5932
+ default: false
5933
+ },
5908
5934
  editorActions: { default: () => void 0 },
5909
5935
  minRows: { default: () => void 0 },
5910
5936
  maxRows: { default: () => void 0 },
@@ -6085,9 +6111,10 @@ getEditor: () => diffEditorInstance });
6085
6111
  state: __props.state,
6086
6112
  "read-only": __props.readOnly,
6087
6113
  "sub-text": __props.subText,
6114
+ "preserve-sub-text-space": __props.preserveSubTextSpace,
6088
6115
  copyable: false,
6089
6116
  "editor-actions": __props.editorActions,
6090
- focused: isEditorFocused.value,
6117
+ "show-focus-highlight": isEditorFocused.value,
6091
6118
  fill: fillContainer.value,
6092
6119
  "code-height": editorHeight.value,
6093
6120
  "change-summary": __props.changeSummary,
@@ -6102,8 +6129,9 @@ getEditor: () => diffEditorInstance });
6102
6129
  "state",
6103
6130
  "read-only",
6104
6131
  "sub-text",
6132
+ "preserve-sub-text-space",
6105
6133
  "editor-actions",
6106
- "focused",
6134
+ "show-focus-highlight",
6107
6135
  "fill",
6108
6136
  "code-height",
6109
6137
  "change-summary",