@knime/kds-code-editor 11.0.0 → 11.1.1

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,21 @@
1
1
  # @knime/kds-code-editor
2
2
 
3
+ ## 11.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [7dbad9a, 2c0897f]
8
+ - @knime/kds-components@11.1.1
9
+ - @knime/kds-styles@11.1.1
10
+
11
+ ## 11.1.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [1cbcad8]
16
+ - @knime/kds-styles@11.1.0
17
+ - @knime/kds-components@11.1.0
18
+
3
19
  ## 11.0.0
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This is part of the [KNIME Design System](https://github.com/knime/knime-designsystem) maintained by the [UI Core Team](mailto:team-ui-core@knime.com).
4
4
 
5
- This package contains the `KdsCodeEditor` component, a code editor that follows the KNIME Design System. It is based on the [Vue] JavaScript framework and powered by the [Monaco editor][Monaco].
5
+ This package contains the `KdsCodeEditor`, `KdsCodeDiffEditor`, and `KdsConsole` components, which follow the KNIME Design System. They are based on the [Vue] JavaScript framework; the editors are powered by the [Monaco editor][Monaco] and the console by [xterm.js][xterm].
6
6
 
7
7
  It's published as npm package: [@knime/kds-code-editor]
8
8
 
@@ -52,28 +52,33 @@ updated with it — re-copy the patch file when you bump Monaco.
52
52
 
53
53
  ### Monaco state is global
54
54
 
55
- Standalone Monaco keeps page-global state, and `KdsCodeEditor` participates
56
- in it:
55
+ Standalone Monaco keeps page-global state, and `KdsCodeEditor` and
56
+ `KdsCodeDiffEditor` participate in it:
57
57
 
58
- - **Theme:** the component switches Monaco's built-in `vs-light` / `vs-dark`
58
+ - **Theme:** the components switch Monaco's built-in `vs-light` / `vs-dark`
59
59
  theme to follow the KDS dark-mode setting — once at mount and again on every
60
60
  dark-mode change. Monaco's theme applies to **every** standalone editor on
61
61
  the page, so the host app's own Monaco editors switch along with it, and a
62
- custom theme set by the host is overridden while a `KdsCodeEditor` is
63
- mounted. If your app defines its own Monaco editors, expect them to render
64
- with `vs-light` / `vs-dark` alongside this component.
65
- - **Worker environment and languages:** `setupMonacoEnvironment` installs a
66
- `MonacoEnvironment` only when the host app has not already defined one, and
67
- the custom language grammars shipped with this package (e.g. `toml`) are
68
- registered in Monaco's global language registry at import time — they are
69
- also available to the host app's own editors.
62
+ custom theme set by the host is overridden while one of them is mounted. If your app defines its own Monaco editors, expect them to render
63
+ with `vs-light` / `vs-dark` alongside these components.
64
+ - **Worker environment and languages:** `setupMonacoEnvironment` (called by
65
+ both editor components on setup) installs a `MonacoEnvironment` only when the
66
+ host app has not already defined one, and registers the custom language
67
+ grammars shipped with this package (e.g. `toml`) in Monaco's global language
68
+ registry — they are then also available to the host app's own editors.
70
69
 
71
70
  ## Using the editor in a Vue application
72
71
 
73
- Install the [@knime/kds-code-editor] npm package as a dependency. It requires `@knime/kds-components`, `monaco-editor`, and `vue` as peer dependencies:
72
+ Install the [@knime/kds-code-editor] npm package together with `@knime/kds-styles`. It declares `monaco-editor`, `vue`, and `@vueuse/core` as peer dependencies:
74
73
 
75
74
  ```sh
76
- pnpm add @knime/kds-code-editor @knime/kds-components @knime/kds-styles monaco-editor
75
+ pnpm add @knime/kds-code-editor @knime/kds-styles monaco-editor vue @vueuse/core
76
+ ```
77
+
78
+ The components use the KDS CSS variables but do not load them. Import them once in your app (e.g. in `main.ts`):
79
+
80
+ ```ts
81
+ import "@knime/kds-styles/kds-variables.css";
77
82
  ```
78
83
 
79
84
  ```vue
@@ -94,18 +99,44 @@ const value = ref('key = "value"');
94
99
 
95
100
  All public symbols follow the KDS `Kds` prefix convention:
96
101
 
97
- | Export | Kind | Description |
98
- | --------------------------------- | --------- | ------------------------------------------------------------- |
99
- | `KdsCodeEditor` | component | The code editor (with header, copy button, and sub-text) |
100
- | `setupMonacoEnvironment` | function | Installs the Monaco worker environment (no-op if already set) |
101
- | `kdsCodeEditorState` | const | Editor states (`default` / `error` / `warning`) |
102
- | `kdsCodeEditorStates` | const | Array of all editor states |
103
- | `KdsCodeEditorProps` | type | Props of `KdsCodeEditor` |
104
- | `KdsCodeEditorState` | type | Union of the editor states |
105
- | `KdsCodeEditorAction` | type | Union of the header action types below |
106
- | `KdsCodeEditorButtonAction` | type | Header action rendered as `KdsButton` |
107
- | `KdsCodeEditorToggleButtonAction` | type | Header action rendered as `KdsToggleButton` |
108
- | `KdsCodeEditorMenuButtonAction` | type | Header action rendered as `KdsMenuButton` |
102
+ | Export | Kind | Description |
103
+ | --------------------------------- | --------- | ------------------------------------------------------------------ |
104
+ | `KdsCodeEditor` | component | The code editor (with header, copy button, and sub-text) |
105
+ | `KdsCodeDiffEditor` | component | Side-by-side or inline diff editor with an optional change summary |
106
+ | `KdsConsole` | component | Read-only output console (xterm.js based) |
107
+ | `setupMonacoEnvironment` | function | Installs the Monaco worker environment (no-op if already set) |
108
+ | `kdsCodeEditorState` | const | Editor states (`default` / `error` / `warning`) |
109
+ | `kdsCodeEditorStates` | const | Array of all editor states |
110
+ | `KdsCodeEditorProps` | type | Props of `KdsCodeEditor` |
111
+ | `KdsCodeDiffEditorProps` | type | Props of `KdsCodeDiffEditor` |
112
+ | `KdsConsoleHandler` | type | Handle for writing to / clearing a `KdsConsole` |
113
+ | `KdsConsoleText` | type | A console line (`{ text }`, `{ warning }`, or `{ error }`) |
114
+ | `KdsCodeEditorState` | type | Union of the editor states |
115
+ | `KdsCodeEditorAction` | type | Union of the header action types below |
116
+ | `KdsCodeEditorButtonAction` | type | Header action rendered as `KdsButton` |
117
+ | `KdsCodeEditorToggleButtonAction` | type | Header action rendered as `KdsToggleButton` |
118
+ | `KdsCodeEditorMenuButtonAction` | type | Header action rendered as `KdsMenuButton` |
119
+
120
+ `KdsConsole` exposes its writer through the `console-created` event rather than
121
+ props — store the handler and call `write` / `writeln` / `clear` from your app.
122
+ The console fills its parent (`height: 100%`), so give the parent a height:
123
+
124
+ ```vue
125
+ <script setup lang="ts">
126
+ import { KdsConsole, type KdsConsoleHandler } from "@knime/kds-code-editor";
127
+
128
+ const onConsoleCreated = (handler: KdsConsoleHandler) => {
129
+ handler.writeln({ text: "Execution started" });
130
+ handler.writeln({ warning: "Deprecated option used" });
131
+ };
132
+ </script>
133
+
134
+ <template>
135
+ <div style="height: 200px">
136
+ <KdsConsole @console-created="onConsoleCreated" />
137
+ </div>
138
+ </template>
139
+ ```
109
140
 
110
141
  ### Using with Vitest, Nuxt, or Vite SSR
111
142
 
@@ -136,4 +167,5 @@ export default defineNuxtConfig({ build: { transpile: [/@knime\//] } });
136
167
 
137
168
  [Vue]: https://vuejs.org/
138
169
  [Monaco]: https://microsoft.github.io/monaco-editor/
170
+ [xterm]: https://xtermjs.org/
139
171
  [@knime/kds-code-editor]: https://www.npmjs.com/package/@knime/kds-code-editor
package/dist/index.js CHANGED
@@ -371,6 +371,62 @@ var color = {
371
371
  }
372
372
  }
373
373
  },
374
+ "neutral-opaque": {
375
+ initial: {
376
+ light: {
377
+ h: 0,
378
+ s: 0,
379
+ l: 99,
380
+ a: 1
381
+ },
382
+ dark: {
383
+ h: 0,
384
+ s: 0,
385
+ l: 22,
386
+ a: 1
387
+ },
388
+ css: {
389
+ value: "light-dark(hsl(0, 0%, 99%), hsl(0, 0%, 22%))",
390
+ variable: "var(--kds-color-background-neutral-opaque-initial)"
391
+ }
392
+ },
393
+ hover: {
394
+ light: {
395
+ h: 0,
396
+ s: 0,
397
+ l: 94.1,
398
+ a: 1
399
+ },
400
+ dark: {
401
+ h: 0,
402
+ s: 0,
403
+ l: 32.2,
404
+ a: 1
405
+ },
406
+ css: {
407
+ value: "light-dark(hsl(0, 0%, 94.1%), hsl(0, 0%, 32.2%))",
408
+ variable: "var(--kds-color-background-neutral-opaque-hover)"
409
+ }
410
+ },
411
+ active: {
412
+ light: {
413
+ h: 0,
414
+ s: 0,
415
+ l: 90.2,
416
+ a: 1
417
+ },
418
+ dark: {
419
+ h: 0,
420
+ s: 0,
421
+ l: 43,
422
+ a: 1
423
+ },
424
+ css: {
425
+ value: "light-dark(hsl(0, 0%, 90.2%), hsl(0, 0%, 43%))",
426
+ variable: "var(--kds-color-background-neutral-opaque-active)"
427
+ }
428
+ }
429
+ },
374
430
  primary: {
375
431
  initial: {
376
432
  light: {
@@ -1798,6 +1854,60 @@ var color = {
1798
1854
  value: "light-dark(hsl(0 0% 10.2% / 0.74), hsl(0 0% 99% / 0.68))",
1799
1855
  variable: "var(--kds-color-border-neutral-bold-active)"
1800
1856
  }
1857
+ },
1858
+ "neutral-opaque-initial": {
1859
+ light: {
1860
+ h: 0,
1861
+ s: 0,
1862
+ l: 64,
1863
+ a: 1
1864
+ },
1865
+ dark: {
1866
+ h: 0,
1867
+ s: 0,
1868
+ l: 64,
1869
+ a: 1
1870
+ },
1871
+ css: {
1872
+ value: "hsl(0, 0%, 64%)",
1873
+ variable: "var(--kds-color-border-neutral-opaque-initial)"
1874
+ }
1875
+ },
1876
+ "neutral-opaque-hover": {
1877
+ light: {
1878
+ h: 0,
1879
+ s: 0,
1880
+ l: 43,
1881
+ a: 1
1882
+ },
1883
+ dark: {
1884
+ h: 0,
1885
+ s: 0,
1886
+ l: 72.5,
1887
+ a: 1
1888
+ },
1889
+ css: {
1890
+ value: "light-dark(hsl(0, 0%, 43%), hsl(0, 0%, 72.5%))",
1891
+ variable: "var(--kds-color-border-neutral-opaque-hover)"
1892
+ }
1893
+ },
1894
+ "neutral-opaque-active": {
1895
+ light: {
1896
+ h: 0,
1897
+ s: 0,
1898
+ l: 32.2,
1899
+ a: 1
1900
+ },
1901
+ dark: {
1902
+ h: 0,
1903
+ s: 0,
1904
+ l: 90.2,
1905
+ a: 1
1906
+ },
1907
+ css: {
1908
+ value: "light-dark(hsl(0, 0%, 32.2%), hsl(0, 0%, 90.2%))",
1909
+ variable: "var(--kds-color-border-neutral-opaque-active)"
1910
+ }
1801
1911
  }
1802
1912
  },
1803
1913
  focus: {