@knime/kds-code-editor 6.2.0 → 6.3.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +11 -5
  3. package/dist/assets/{editor.worker-CLAZlRUj.js.map → editor.worker-e3drisr8.js.map} +1 -1
  4. package/dist/assets/{json.worker-CWsWF5cb.js.map → json.worker-BxEEOmOS.js.map} +1 -1
  5. package/dist/{editor.worker-CtYtPH8e.js → editor.worker-BaqEYUwK.js} +3 -3
  6. package/dist/editor.worker-BaqEYUwK.js.map +1 -0
  7. package/dist/index.css +51 -14
  8. package/dist/index.js +837 -134
  9. package/dist/index.js.map +1 -1
  10. package/dist/{json.worker-B5MqtfsC.js → json.worker-CzwQ13T2.js} +3 -3
  11. package/dist/json.worker-CzwQ13T2.js.map +1 -0
  12. package/dist/src/CodeDiffEditor/KdsCodeDiffEditor.vue.d.ts +28 -0
  13. package/dist/src/CodeDiffEditor/KdsCodeDiffEditor.vue.d.ts.map +1 -0
  14. package/dist/src/CodeDiffEditor/index.d.ts +3 -0
  15. package/dist/src/CodeDiffEditor/index.d.ts.map +1 -0
  16. package/dist/src/CodeDiffEditor/types.d.ts +79 -0
  17. package/dist/src/CodeDiffEditor/types.d.ts.map +1 -0
  18. package/dist/src/CodeEditor/KdsCodeEditor.vue.d.ts.map +1 -1
  19. package/dist/src/CodeEditor/monacoEnvironment.d.ts.map +1 -1
  20. package/dist/src/CodeEditor/tomlLanguage.d.ts +10 -1
  21. package/dist/src/CodeEditor/tomlLanguage.d.ts.map +1 -1
  22. package/dist/src/_helper/BaseCodeEditor.vue.d.ts +28 -0
  23. package/dist/src/_helper/BaseCodeEditor.vue.d.ts.map +1 -0
  24. package/dist/src/_helper/monacoCommon.d.ts +42 -0
  25. package/dist/src/_helper/monacoCommon.d.ts.map +1 -0
  26. package/dist/src/_helper/types.d.ts +49 -0
  27. package/dist/src/_helper/types.d.ts.map +1 -0
  28. package/dist/src/index.d.ts +2 -0
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/package.json +3 -3
  31. package/patches/monaco-editor@0.55.1.patch +24 -0
  32. package/dist/editor.worker-CtYtPH8e.js.map +0 -1
  33. package/dist/json.worker-B5MqtfsC.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,11 +1,178 @@
1
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, mergeProps, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef, watch, watchEffect } from "vue";
1
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef, vShow, watch, watchEffect, withCtx, withDirectives } from "vue";
2
2
  import { useClipboard, useDebounceFn, useResizeObserver } from "@vueuse/core";
3
- import { KeyCode, editor } from "monaco-editor";
3
+ import { KeyCode, editor, languages } from "monaco-editor";
4
4
  import { KdsButton, KdsMenuButton, KdsProgressButton, KdsSubText, KdsToggleButton, useKdsDarkMode } from "@knime/kds-components";
5
5
  import { FitAddon } from "@xterm/addon-fit";
6
6
  import { Unicode11Addon } from "@xterm/addon-unicode11";
7
7
  import { Terminal } from "@xterm/xterm";
8
- import './index.css';//#region ../styles/dist/tokens/ts/color.js
8
+ import './index.css';//#region src/CodeEditor/enums.ts
9
+ var kdsCodeEditorState = {
10
+ DEFAULT: "default",
11
+ ERROR: "error",
12
+ WARNING: "warning"
13
+ };
14
+ var kdsCodeEditorStates = Object.values(kdsCodeEditorState);
15
+ //#endregion
16
+ //#region src/_helper/BaseCodeEditor.vue?vue&type=script&setup=true&lang.ts
17
+ var _hoisted_1 = {
18
+ key: 0,
19
+ class: "header"
20
+ };
21
+ var _hoisted_2 = { class: "left-block" };
22
+ var _hoisted_3 = { class: "title" };
23
+ var _hoisted_4 = {
24
+ key: 0,
25
+ class: "title"
26
+ };
27
+ var _hoisted_5 = {
28
+ class: "change-counts",
29
+ "aria-hidden": "true"
30
+ };
31
+ var _hoisted_6 = { class: "added-lines" };
32
+ var _hoisted_7 = { class: "removed-lines" };
33
+ var _hoisted_8 = { class: "change-counts-for-screen-readers" };
34
+ var _hoisted_9 = { class: "action-buttons" };
35
+ var _hoisted_10 = ["id"];
36
+ var _hoisted_11 = {
37
+ key: 1,
38
+ class: "footer"
39
+ };
40
+ var BaseCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
41
+ __name: "BaseCodeEditor",
42
+ props: {
43
+ headerLabel: {},
44
+ subTextId: {},
45
+ hideHeader: {
46
+ type: Boolean,
47
+ default: false
48
+ },
49
+ state: { default: () => kdsCodeEditorState.DEFAULT },
50
+ readOnly: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ subText: { default: () => void 0 },
55
+ copyable: {
56
+ type: Boolean,
57
+ default: true
58
+ },
59
+ copied: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ copyButtonAriaLabel: { default: "" },
64
+ editorActions: { default: () => void 0 },
65
+ focused: {
66
+ type: Boolean,
67
+ default: false
68
+ },
69
+ fill: {
70
+ type: Boolean,
71
+ default: false
72
+ },
73
+ codeHeight: { default: () => void 0 },
74
+ changeSummary: { default: () => void 0 },
75
+ addedLines: { default: () => void 0 },
76
+ removedLines: { default: () => void 0 },
77
+ collapsed: {
78
+ type: Boolean,
79
+ default: false
80
+ }
81
+ },
82
+ emits: ["copy", "collapsedToggle"],
83
+ setup(__props, { expose: __expose, emit: __emit }) {
84
+ const emit = __emit;
85
+ const codeContainer = useTemplateRef("code-container");
86
+ const codeContainerId = useId();
87
+ __expose({
88
+ /** The element Monaco should be mounted into. */
89
+ getCodeContainer: () => codeContainer.value });
90
+ return (_ctx, _cache) => {
91
+ return openBlock(), createElementBlock("div", { class: normalizeClass(["kds-code-editor", { fill: __props.fill }]) }, [createElementVNode("div", { class: normalizeClass([
92
+ "editor",
93
+ __props.state,
94
+ {
95
+ focused: __props.focused,
96
+ collapsed: __props.collapsed
97
+ }
98
+ ]) }, [
99
+ !__props.hideHeader ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
100
+ createElementVNode("span", _hoisted_3, toDisplayString(__props.changeSummary ?? __props.headerLabel), 1),
101
+ __props.readOnly === true ? (openBlock(), createElementBlock("span", _hoisted_4, "(Read-only)")) : createCommentVNode("", true),
102
+ __props.changeSummary !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [__props.addedLines !== void 0 && __props.removedLines !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_5, [createElementVNode("span", _hoisted_6, "+" + toDisplayString(__props.addedLines), 1), createElementVNode("span", _hoisted_7, "-" + toDisplayString(__props.removedLines), 1)]), createElementVNode("span", _hoisted_8, toDisplayString(__props.addedLines) + " added and " + toDisplayString(__props.removedLines) + " removed lines ", 1)], 64)) : createCommentVNode("", true), createVNode(unref(KdsButton), mergeProps({ ariaLabel: __props.collapsed ? "Expand code diff" : "Collapse code diff" }, {
103
+ "aria-expanded": !__props.collapsed,
104
+ "aria-controls": unref(codeContainerId),
105
+ "leading-icon": __props.collapsed ? "chevron-left" : "chevron-down",
106
+ size: "small",
107
+ variant: "transparent",
108
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("collapsedToggle"))
109
+ }), null, 16, [
110
+ "aria-expanded",
111
+ "aria-controls",
112
+ "leading-icon"
113
+ ])], 64)) : createCommentVNode("", true)
114
+ ]), createElementVNode("div", _hoisted_9, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.editorActions, (action, index) => {
115
+ return openBlock(), createElementBlock(Fragment, { key: `editor-action-${index}` }, [action.type === "button" ? (openBlock(), createBlock(unref(KdsButton), mergeProps({
116
+ key: 0,
117
+ ref_for: true
118
+ }, action.props, {
119
+ size: "small",
120
+ onClick: action.onClick
121
+ }), null, 16, ["onClick"])) : action.type === "toggleButton" ? (openBlock(), createBlock(unref(KdsToggleButton), mergeProps({
122
+ key: 1,
123
+ ref_for: true
124
+ }, action.props, {
125
+ size: "small",
126
+ "onUpdate:modelValue": action.onUpdateModelValue
127
+ }), null, 16, ["onUpdate:modelValue"])) : action.type === "menuButton" ? (openBlock(), createBlock(unref(KdsMenuButton), mergeProps({
128
+ key: 2,
129
+ ref_for: true
130
+ }, action.props, {
131
+ size: "small",
132
+ onItemClick: action.onItemClick
133
+ }), null, 16, ["onItemClick"])) : createCommentVNode("", true)], 64);
134
+ }), 128)), __props.copyable ? (openBlock(), createBlock(unref(KdsProgressButton), mergeProps({ key: 0 }, { ariaLabel: __props.copyButtonAriaLabel }, {
135
+ "leading-icon": __props.copied ? "checkmark" : "copy",
136
+ state: __props.copied ? "success" : "default",
137
+ size: "small",
138
+ variant: "transparent",
139
+ tooltip: "Copy to clipboard",
140
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("copy"))
141
+ }), null, 16, ["leading-icon", "state"])) : createCommentVNode("", true)])])) : createCommentVNode("", true),
142
+ withDirectives(createElementVNode("div", {
143
+ id: unref(codeContainerId),
144
+ ref: "code-container",
145
+ class: "code",
146
+ style: normalizeStyle(__props.codeHeight ? { height: __props.codeHeight } : void 0)
147
+ }, null, 12, _hoisted_10), [[vShow, !__props.collapsed]]),
148
+ _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,
151
+ id: __props.subTextId,
152
+ "sub-text": __props.subText,
153
+ error: __props.state === unref(kdsCodeEditorState).ERROR,
154
+ warning: __props.state === unref(kdsCodeEditorState).WARNING
155
+ }, null, 8, [
156
+ "id",
157
+ "sub-text",
158
+ "error",
159
+ "warning"
160
+ ])) : createCommentVNode("", true)], 2);
161
+ };
162
+ }
163
+ });
164
+ //#endregion
165
+ //#region \0plugin-vue:export-helper
166
+ var _plugin_vue_export_helper_default = (sfc, props) => {
167
+ const target = sfc.__vccOpts || sfc;
168
+ for (const [key, val] of props) target[key] = val;
169
+ return target;
170
+ };
171
+ //#endregion
172
+ //#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"]]);
174
+ //#endregion
175
+ //#region ../styles/dist/tokens/ts/color.js
9
176
  /**
10
177
  * Do not edit directly, this file was auto-generated
11
178
  * from the design token sources in src/tokens.
@@ -5087,52 +5254,406 @@ var font = {
5087
5254
  }
5088
5255
  };
5089
5256
  //#endregion
5090
- //#region src/CodeEditor/enums.ts
5091
- var kdsCodeEditorState = {
5092
- DEFAULT: "default",
5093
- ERROR: "error",
5094
- WARNING: "warning"
5257
+ //#region src/_helper/monacoCommon.ts
5258
+ var codeFont = font.base.code.small;
5259
+ /**
5260
+ * Construction options shared by `KdsCodeEditor` and `KdsCodeDiffEditor`.
5261
+ */
5262
+ var COMMON_EDITOR_OPTIONS = {
5263
+ automaticLayout: true,
5264
+ minimap: { enabled: false },
5265
+ scrollBeyondLastLine: false,
5266
+ lineNumbersMinChars: 3,
5267
+ fontFamily: `"${codeFont.fontFamily}", monospace`,
5268
+ fontWeight: `${codeFont.fontWeight}`,
5269
+ fontSize: codeFont.fontSize.value,
5270
+ fixedOverflowWidgets: true,
5271
+ scrollbar: { alwaysConsumeMouseWheel: false },
5272
+ accessibilitySupport: "on"
5273
+ };
5274
+ var MONACO_THEME_LIGHT = "vs-light";
5275
+ var MONACO_THEME_DARK = "vs-dark";
5276
+ var getMonacoTheme = (isDark) => isDark ? MONACO_THEME_DARK : MONACO_THEME_LIGHT;
5277
+ /**
5278
+ * Monaco's overflow widgets (error tooltips, autocomplete) can clip or appear
5279
+ * far away from the pointer in certain containers (such as stories in
5280
+ * Storybook, or ancestors with a CSS `transform`). Hosting them in an
5281
+ * external node on `document.body` avoids that; the node needs the
5282
+ * `monaco-editor` class to keep the popover styling. The caller owns the
5283
+ * returned node and must remove it on unmount.
5284
+ */
5285
+ var createOverflowWidgetsDomNode = () => {
5286
+ const node = document.createElement("div");
5287
+ node.classList.add("monaco-editor");
5288
+ document.body.appendChild(node);
5289
+ return node;
5290
+ };
5291
+ /**
5292
+ * Accessibility: Escape arms tab-focus mode on the given editor so the next
5293
+ * Tab (or Shift+Tab) moves focus out of the editor instead of indenting;
5294
+ * any other key press or re-entering the editor restores Tab-as-indentation.
5295
+ */
5296
+ var setupTabFocusHandling = (editorInstance) => {
5297
+ let tabFocusArmed = false;
5298
+ const setTabFocus = (armed) => {
5299
+ if (tabFocusArmed !== armed) {
5300
+ tabFocusArmed = armed;
5301
+ editorInstance.updateOptions({ tabFocusMode: armed });
5302
+ }
5303
+ };
5304
+ const tabFocusNeutralKeys = [
5305
+ KeyCode.Tab,
5306
+ KeyCode.Shift,
5307
+ KeyCode.Ctrl,
5308
+ KeyCode.Alt,
5309
+ KeyCode.Meta
5310
+ ];
5311
+ editorInstance.onKeyDown((event) => {
5312
+ if (event.keyCode === KeyCode.Escape) setTabFocus(true);
5313
+ else if (!tabFocusNeutralKeys.includes(event.keyCode)) setTabFocus(false);
5314
+ });
5315
+ editorInstance.onDidFocusEditorText(() => {
5316
+ setTabFocus(false);
5317
+ });
5318
+ };
5319
+ //#endregion
5320
+ //#region src/CodeEditor/tomlLanguage.ts
5321
+ /**
5322
+ * Monarch syntax definition for TOML (v1.1.0).
5323
+ * Registers "toml" as a language with Monaco Editor.
5324
+ *
5325
+ * Uses compound patterns (like GitHub's TextMate TOML grammar) to distinguish
5326
+ * table headers, keys, and values without relying on end-of-line state pops:
5327
+ * - Table headers: matched as whole `[key.path]` / `[[key.path]]` patterns
5328
+ * - Key assignments: matched as `key =` compound patterns
5329
+ * - Values: matched directly in root (strings, numbers, booleans, dates)
5330
+ * - Arrays / inline tables: use sub-states for bracket matching
5331
+ *
5332
+ * Spec: https://toml.io/en/v1.1.0
5333
+ * Monarch docs: https://microsoft.github.io/monaco-editor/monarch.html
5334
+ */
5335
+ /**
5336
+ * Registers the TOML language with Monaco. Idempotent — registering is
5337
+ * page-global, so the first call wins and later calls return early.
5338
+ *
5339
+ * Called explicitly (from `setupMonacoEnvironment`) rather than as a
5340
+ * module side effect: the package declares `sideEffects` in its
5341
+ * package.json, so bundlers are allowed to drop bare side-effect imports
5342
+ * of this module in production builds.
5343
+ */
5344
+ var registerTomlLanguage = () => {
5345
+ if (languages.getLanguages().some((language) => language.id === "toml")) return;
5346
+ languages.register({ id: "toml" });
5347
+ languages.setLanguageConfiguration("toml", {
5348
+ comments: { lineComment: "#" },
5349
+ brackets: [["{", "}"], ["[", "]"]],
5350
+ autoClosingPairs: [
5351
+ {
5352
+ open: "{",
5353
+ close: "}"
5354
+ },
5355
+ {
5356
+ open: "[",
5357
+ close: "]"
5358
+ },
5359
+ {
5360
+ open: "\"\"\"",
5361
+ close: "\"\"\""
5362
+ },
5363
+ {
5364
+ open: "'''",
5365
+ close: "'''"
5366
+ },
5367
+ {
5368
+ open: "\"",
5369
+ close: "\"",
5370
+ notIn: ["string"]
5371
+ },
5372
+ {
5373
+ open: "'",
5374
+ close: "'",
5375
+ notIn: ["string"]
5376
+ }
5377
+ ],
5378
+ surroundingPairs: [
5379
+ {
5380
+ open: "{",
5381
+ close: "}"
5382
+ },
5383
+ {
5384
+ open: "[",
5385
+ close: "]"
5386
+ },
5387
+ {
5388
+ open: "\"",
5389
+ close: "\""
5390
+ },
5391
+ {
5392
+ open: "'",
5393
+ close: "'"
5394
+ }
5395
+ ]
5396
+ });
5397
+ languages.setMonarchTokensProvider("toml", {
5398
+ defaultToken: "",
5399
+ brackets: [{
5400
+ open: "[",
5401
+ close: "]",
5402
+ token: "delimiter.square"
5403
+ }, {
5404
+ open: "{",
5405
+ close: "}",
5406
+ token: "delimiter.curly"
5407
+ }],
5408
+ escapes: /\\(?:[btnfre"\\]|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
5409
+ tokenizer: {
5410
+ root: [
5411
+ { include: "@whitespace" },
5412
+ { include: "@comment" },
5413
+ [/(\[\[)(\s*[A-Za-z0-9_-]+(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*)(\]\])/, [
5414
+ "metatag.delimiter",
5415
+ "metatag",
5416
+ "metatag.delimiter"
5417
+ ]],
5418
+ [/(\[)(\s*[A-Za-z0-9_-]+(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*)(\])/, [
5419
+ "metatag.delimiter",
5420
+ "metatag",
5421
+ "metatag.delimiter"
5422
+ ]],
5423
+ [/([A-Za-z0-9_-]+)(\s*)(=)/, [
5424
+ "type",
5425
+ "white",
5426
+ "operators"
5427
+ ]],
5428
+ [/("[^"]*")(\s*)(=)/, [
5429
+ "type",
5430
+ "white",
5431
+ "operators"
5432
+ ]],
5433
+ [/('[^']*')(\s*)(=)/, [
5434
+ "type",
5435
+ "white",
5436
+ "operators"
5437
+ ]],
5438
+ [/([A-Za-z0-9_-]+)(\s*)(\.)/, [
5439
+ "type",
5440
+ "white",
5441
+ "delimiter"
5442
+ ]],
5443
+ [/("[^"]*")(\s*)(\.)/, [
5444
+ "type",
5445
+ "white",
5446
+ "delimiter"
5447
+ ]],
5448
+ [/('[^']*')(\s*)(\.)/, [
5449
+ "type",
5450
+ "white",
5451
+ "delimiter"
5452
+ ]],
5453
+ [
5454
+ /\{/,
5455
+ "@brackets",
5456
+ "@inlineTable"
5457
+ ],
5458
+ [
5459
+ /\[/,
5460
+ "@brackets",
5461
+ "@array"
5462
+ ],
5463
+ { include: "@strings" },
5464
+ { include: "@dateTime" },
5465
+ { include: "@numbers" },
5466
+ { include: "@booleans" },
5467
+ [/[=,]/, "delimiter"]
5468
+ ],
5469
+ inlineTable: [
5470
+ { include: "@whitespace" },
5471
+ { include: "@comment" },
5472
+ [
5473
+ /\}/,
5474
+ "@brackets",
5475
+ "@pop"
5476
+ ],
5477
+ [/,/, "delimiter"],
5478
+ [/([A-Za-z0-9_-]+)(\s*)(=)/, [
5479
+ "type",
5480
+ "white",
5481
+ "operators"
5482
+ ]],
5483
+ [/("[^"]*")(\s*)(=)/, [
5484
+ "type",
5485
+ "white",
5486
+ "operators"
5487
+ ]],
5488
+ [/('[^']*')(\s*)(=)/, [
5489
+ "type",
5490
+ "white",
5491
+ "operators"
5492
+ ]],
5493
+ [/([A-Za-z0-9_-]+)(\s*)(\.)/, [
5494
+ "type",
5495
+ "white",
5496
+ "delimiter"
5497
+ ]],
5498
+ [/("[^"]*")(\s*)(\.)/, [
5499
+ "type",
5500
+ "white",
5501
+ "delimiter"
5502
+ ]],
5503
+ [/('[^']*')(\s*)(\.)/, [
5504
+ "type",
5505
+ "white",
5506
+ "delimiter"
5507
+ ]],
5508
+ [
5509
+ /\{/,
5510
+ "@brackets",
5511
+ "@inlineTable"
5512
+ ],
5513
+ [
5514
+ /\[/,
5515
+ "@brackets",
5516
+ "@array"
5517
+ ],
5518
+ { include: "@strings" },
5519
+ { include: "@dateTime" },
5520
+ { include: "@numbers" },
5521
+ { include: "@booleans" }
5522
+ ],
5523
+ array: [
5524
+ { include: "@whitespace" },
5525
+ { include: "@comment" },
5526
+ [
5527
+ /\]/,
5528
+ "@brackets",
5529
+ "@pop"
5530
+ ],
5531
+ [/,/, "delimiter"],
5532
+ [
5533
+ /\{/,
5534
+ "@brackets",
5535
+ "@inlineTable"
5536
+ ],
5537
+ [
5538
+ /\[/,
5539
+ "@brackets",
5540
+ "@array"
5541
+ ],
5542
+ { include: "@strings" },
5543
+ { include: "@dateTime" },
5544
+ { include: "@numbers" },
5545
+ { include: "@booleans" }
5546
+ ],
5547
+ whitespace: [[/[ \t\r\n]+/, "white"]],
5548
+ comment: [[/#.*$/, "comment"]],
5549
+ booleans: [[/(?:true|false)(?![A-Za-z0-9_-])/, "keyword"]],
5550
+ dateTime: [
5551
+ [/\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?/, "number"],
5552
+ [/\d{4}-\d{2}-\d{2}/, "number"],
5553
+ [/\d{2}:\d{2}(:\d{2}(\.\d+)?)?/, "number"]
5554
+ ],
5555
+ numbers: [
5556
+ [/0x[0-9A-Fa-f][0-9A-Fa-f_]*/, "number.hex"],
5557
+ [/0o[0-7][0-7_]*/, "number.octal"],
5558
+ [/0b[01][01_]*/, "number.binary"],
5559
+ [/[+-]?(?:inf|nan)(?![A-Za-z0-9_-])/, "number.float"],
5560
+ [/[+-]?\d[\d_]*\.\d[\d_]*([eE][+-]?\d[\d_]*)?/, "number.float"],
5561
+ [/[+-]?\d[\d_]*[eE][+-]?\d[\d_]*/, "number.float"],
5562
+ [/[+-]?\d[\d_]*/, "number"]
5563
+ ],
5564
+ strings: [
5565
+ [
5566
+ /"""/,
5567
+ "string",
5568
+ "@string.multiBasic"
5569
+ ],
5570
+ [
5571
+ /'''/,
5572
+ "string",
5573
+ "@string.multiLiteral"
5574
+ ],
5575
+ [
5576
+ /"/,
5577
+ "string",
5578
+ "@string.basic"
5579
+ ],
5580
+ [
5581
+ /'/,
5582
+ "string",
5583
+ "@string.literal"
5584
+ ]
5585
+ ],
5586
+ "string.basic": [
5587
+ [
5588
+ /[^\\"]*$/,
5589
+ "string.invalid",
5590
+ "@pop"
5591
+ ],
5592
+ [/[^\\"]+/, "string"],
5593
+ [/@escapes/, "string.escape"],
5594
+ [/\\./, "string.escape.invalid"],
5595
+ [
5596
+ /"/,
5597
+ "string",
5598
+ "@pop"
5599
+ ]
5600
+ ],
5601
+ "string.multiBasic": [
5602
+ [
5603
+ /"""/,
5604
+ "string",
5605
+ "@pop"
5606
+ ],
5607
+ [/[^\\"]+/, "string"],
5608
+ [/@escapes/, "string.escape"],
5609
+ [/\\./, "string.escape.invalid"],
5610
+ [/"/, "string"]
5611
+ ],
5612
+ "string.literal": [
5613
+ [
5614
+ /[^']*$/,
5615
+ "string.invalid",
5616
+ "@pop"
5617
+ ],
5618
+ [/[^']+/, "string"],
5619
+ [
5620
+ /'/,
5621
+ "string",
5622
+ "@pop"
5623
+ ]
5624
+ ],
5625
+ "string.multiLiteral": [
5626
+ [
5627
+ /'''/,
5628
+ "string",
5629
+ "@pop"
5630
+ ],
5631
+ [/[^']+/, "string"],
5632
+ [/'/, "string"]
5633
+ ]
5634
+ }
5635
+ });
5095
5636
  };
5096
- var kdsCodeEditorStates = Object.values(kdsCodeEditorState);
5097
5637
  //#endregion
5098
5638
  //#region src/CodeEditor/monacoEnvironment.ts
5099
5639
  document.fonts?.ready.then(() => {
5100
5640
  editor.remeasureFonts();
5101
5641
  });
5102
5642
  var setupMonacoEnvironment = () => {
5643
+ registerTomlLanguage();
5103
5644
  if (self.MonacoEnvironment) return;
5104
5645
  self.MonacoEnvironment = { getWorker: async (_workerId, label) => {
5105
5646
  if (label === "json") {
5106
- const { default: JSONWorker } = await import("./json.worker-B5MqtfsC.js");
5647
+ const { default: JSONWorker } = await import("./json.worker-CzwQ13T2.js");
5107
5648
  return new JSONWorker();
5108
5649
  }
5109
- const { default: EditorWorker } = await import("./editor.worker-CtYtPH8e.js");
5650
+ const { default: EditorWorker } = await import("./editor.worker-BaqEYUwK.js");
5110
5651
  return new EditorWorker();
5111
5652
  } };
5112
5653
  };
5113
5654
  //#endregion
5114
- //#region src/CodeEditor/KdsCodeEditor.vue?vue&type=script&setup=true&lang.ts
5115
- var _hoisted_1 = {
5116
- key: 0,
5117
- class: "header"
5118
- };
5119
- var _hoisted_2 = { class: "left-block" };
5120
- var _hoisted_3 = { class: "title" };
5121
- var _hoisted_4 = {
5122
- key: 0,
5123
- class: "title"
5124
- };
5125
- var _hoisted_5 = { class: "action-buttons" };
5126
- var _hoisted_6 = {
5127
- key: 1,
5128
- class: "footer"
5129
- };
5130
- var INITIAL_LINE_HEIGHT = 18;
5131
- var EXTRA_PADDING = 3;
5132
- var DEFAULT_OVERVIEW_RULER_LANES = 3;
5133
- var MONACO_THEME_LIGHT = "vs-light";
5134
- var MONACO_THEME_DARK = "vs-dark";
5135
- var KdsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
5655
+ //#region src/CodeEditor/KdsCodeEditor.vue
5656
+ var KdsCodeEditor_default = /* @__PURE__ */ defineComponent({
5136
5657
  __name: "KdsCodeEditor",
5137
5658
  props: /*@__PURE__*/ mergeModels({
5138
5659
  language: { default: "plaintext" },
@@ -5167,26 +5688,24 @@ var KdsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
5167
5688
  setupMonacoEnvironment();
5168
5689
  const modelValue = useModel(__props, "modelValue");
5169
5690
  const subTextId = useId();
5170
- const container = useTemplateRef("editor-container");
5691
+ const baseCodeEditor = useTemplateRef("base-code-editor");
5171
5692
  let editorInstance;
5172
5693
  let overflowWidgetsDomNode;
5173
5694
  const isEditorFocused = ref(false);
5174
5695
  const headerLabel = computed(() => __props.languageLabel ?? __props.language.toUpperCase());
5175
5696
  const editorAriaLabel = computed(() => `${headerLabel.value} code editor${__props.readOnly ? ", read-only" : ""}. Press Escape followed by Tab to move focus out of the editor.`);
5176
5697
  const fillContainer = computed(() => __props.minRows === void 0 && __props.maxRows === void 0);
5177
- const lineHeight = ref(INITIAL_LINE_HEIGHT);
5698
+ const lineHeight = ref(18);
5178
5699
  const contentLineCount = ref(1);
5179
5700
  const editorHeight = computed(() => {
5180
5701
  if (fillContainer.value) return;
5181
5702
  const floor = Math.max(__props.minRows ?? 1, 1);
5182
5703
  const cap = __props.maxRows ?? Infinity;
5183
5704
  const rows = Math.min(cap, Math.max(floor, contentLineCount.value));
5184
- return `${lineHeight.value * rows + EXTRA_PADDING}px`;
5705
+ return `${lineHeight.value * rows + 3}px`;
5185
5706
  });
5186
- const codeFont = font.base.code.small;
5187
- const getMonacoTheme = (dark) => dark ? MONACO_THEME_DARK : MONACO_THEME_LIGHT;
5188
5707
  const { isDark } = useKdsDarkMode();
5189
- const getEditorInputElement = () => container.value?.querySelector("[role=\"textbox\"]");
5708
+ const getEditorInputElement = () => baseCodeEditor.value?.getCodeContainer()?.querySelector("[role=\"textbox\"]");
5190
5709
  const syncEditorInputAria = () => {
5191
5710
  const input = getEditorInputElement();
5192
5711
  if (!input) return;
@@ -5202,28 +5721,18 @@ var KdsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
5202
5721
  copy(editorInstance?.getModel()?.getValue() ?? "");
5203
5722
  };
5204
5723
  onMounted(() => {
5205
- if (!container.value) return;
5206
- overflowWidgetsDomNode = document.createElement("div");
5207
- overflowWidgetsDomNode.classList.add("monaco-editor");
5208
- document.body.appendChild(overflowWidgetsDomNode);
5209
- editorInstance = editor.create(container.value, {
5724
+ const container = baseCodeEditor.value?.getCodeContainer();
5725
+ if (!container) return;
5726
+ overflowWidgetsDomNode = createOverflowWidgetsDomNode();
5727
+ editorInstance = editor.create(container, {
5728
+ ...COMMON_EDITOR_OPTIONS,
5210
5729
  value: modelValue.value,
5211
5730
  language: __props.language,
5212
- automaticLayout: true,
5213
- minimap: { enabled: false },
5214
- overviewRulerLanes: __props.overviewRuler ? DEFAULT_OVERVIEW_RULER_LANES : 0,
5215
- scrollBeyondLastLine: false,
5216
- lineNumbersMinChars: 3,
5217
- fontFamily: `"${codeFont.fontFamily}", monospace`,
5218
- fontWeight: `${codeFont.fontWeight}`,
5219
- fontSize: codeFont.fontSize.value,
5220
- fixedOverflowWidgets: true,
5731
+ overviewRulerLanes: __props.overviewRuler ? 3 : 0,
5221
5732
  overflowWidgetsDomNode,
5222
- scrollbar: { alwaysConsumeMouseWheel: false },
5223
5733
  readOnly: __props.readOnly,
5224
5734
  theme: getMonacoTheme(isDark.value),
5225
- ariaLabel: editorAriaLabel.value,
5226
- accessibilitySupport: "on"
5735
+ ariaLabel: editorAriaLabel.value
5227
5736
  });
5228
5737
  syncEditorInputAria();
5229
5738
  lineHeight.value = editorInstance.getOption(editor.EditorOption.lineHeight);
@@ -5233,26 +5742,8 @@ var KdsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
5233
5742
  contentLineCount.value = editorInstance?.getModel()?.getLineCount() ?? 1;
5234
5743
  if (value !== modelValue.value) modelValue.value = value;
5235
5744
  });
5236
- let tabFocusArmed = false;
5237
- const setTabFocus = (armed) => {
5238
- if (tabFocusArmed !== armed) {
5239
- tabFocusArmed = armed;
5240
- editorInstance?.updateOptions({ tabFocusMode: armed });
5241
- }
5242
- };
5243
- const tabFocusNeutralKeys = [
5244
- KeyCode.Tab,
5245
- KeyCode.Shift,
5246
- KeyCode.Ctrl,
5247
- KeyCode.Alt,
5248
- KeyCode.Meta
5249
- ];
5250
- editorInstance.onKeyDown((event) => {
5251
- if (event.keyCode === KeyCode.Escape) setTabFocus(true);
5252
- else if (!tabFocusNeutralKeys.includes(event.keyCode)) setTabFocus(false);
5253
- });
5745
+ setupTabFocusHandling(editorInstance);
5254
5746
  editorInstance.onDidFocusEditorText(() => {
5255
- setTabFocus(false);
5256
5747
  isEditorFocused.value = true;
5257
5748
  });
5258
5749
  editorInstance.onDidBlurEditorText(() => {
@@ -5269,7 +5760,7 @@ var KdsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
5269
5760
  editorInstance?.updateOptions({ ariaLabel });
5270
5761
  });
5271
5762
  watch(() => __props.overviewRuler, (enabled) => {
5272
- editorInstance?.updateOptions({ overviewRulerLanes: enabled ? DEFAULT_OVERVIEW_RULER_LANES : 0 });
5763
+ editorInstance?.updateOptions({ overviewRulerLanes: enabled ? 3 : 0 });
5273
5764
  });
5274
5765
  watch(() => __props.language, (newLanguage) => {
5275
5766
  const model = editorInstance?.getModel();
@@ -5293,70 +5784,282 @@ var KdsCodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
5293
5784
  /** The underlying Monaco editor instance, available after mount. */
5294
5785
  getEditor: () => editorInstance });
5295
5786
  return (_ctx, _cache) => {
5296
- return openBlock(), createElementBlock("div", { class: normalizeClass(["kds-code-editor", { fill: fillContainer.value }]) }, [createElementVNode("div", { class: normalizeClass([
5297
- "editor",
5298
- __props.state,
5299
- { focused: isEditorFocused.value }
5300
- ]) }, [
5301
- !__props.hideHeader ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("span", _hoisted_3, toDisplayString(headerLabel.value), 1), __props.readOnly === true ? (openBlock(), createElementBlock("span", _hoisted_4, "(Read-only)")) : createCommentVNode("", true)]), createElementVNode("div", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.editorActions, (action, index) => {
5302
- return openBlock(), createElementBlock(Fragment, { key: `editor-action-${index}` }, [action.type === "button" ? (openBlock(), createBlock(unref(KdsButton), mergeProps({
5303
- key: 0,
5304
- ref_for: true
5305
- }, action.props, {
5306
- size: "small",
5307
- onClick: action.onClick
5308
- }), null, 16, ["onClick"])) : action.type === "toggleButton" ? (openBlock(), createBlock(unref(KdsToggleButton), mergeProps({
5309
- key: 1,
5310
- ref_for: true
5311
- }, action.props, {
5312
- size: "small",
5313
- "onUpdate:modelValue": action.onUpdateModelValue
5314
- }), null, 16, ["onUpdate:modelValue"])) : action.type === "menuButton" ? (openBlock(), createBlock(unref(KdsMenuButton), mergeProps({
5315
- key: 2,
5316
- ref_for: true
5317
- }, action.props, {
5318
- size: "small",
5319
- onItemClick: action.onItemClick
5320
- }), null, 16, ["onItemClick"])) : createCommentVNode("", true)], 64);
5321
- }), 128)), __props.copyable ? (openBlock(), createBlock(unref(KdsProgressButton), mergeProps({ key: 0 }, { ariaLabel: copyButtonAriaLabel.value }, {
5322
- "leading-icon": unref(copied) ? "checkmark" : "copy",
5323
- state: unref(copied) ? "success" : "default",
5324
- size: "small",
5325
- variant: "transparent",
5326
- tooltip: "Copy to clipboard",
5327
- onClick: copyToClipboard
5328
- }), null, 16, ["leading-icon", "state"])) : createCommentVNode("", true)])])) : createCommentVNode("", true),
5329
- createElementVNode("div", {
5330
- ref: "editor-container",
5331
- class: "code",
5332
- style: normalizeStyle(editorHeight.value ? { height: editorHeight.value } : void 0)
5333
- }, null, 4),
5334
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "footer", {}, void 0, true)])) : createCommentVNode("", true)
5335
- ], 2), __props.subText ? (openBlock(), createBlock(unref(KdsSubText), {
5336
- key: 0,
5337
- id: unref(subTextId),
5787
+ return openBlock(), createBlock(BaseCodeEditor_default, {
5788
+ ref: "base-code-editor",
5789
+ "header-label": headerLabel.value,
5790
+ "sub-text-id": unref(subTextId),
5791
+ "hide-header": __props.hideHeader,
5792
+ state: __props.state,
5793
+ "read-only": __props.readOnly,
5338
5794
  "sub-text": __props.subText,
5339
- error: __props.state === unref(kdsCodeEditorState).ERROR,
5340
- warning: __props.state === unref(kdsCodeEditorState).WARNING
5341
- }, null, 8, [
5342
- "id",
5795
+ copyable: __props.copyable,
5796
+ copied: unref(copied),
5797
+ "copy-button-aria-label": copyButtonAriaLabel.value,
5798
+ "editor-actions": __props.editorActions,
5799
+ focused: isEditorFocused.value,
5800
+ fill: fillContainer.value,
5801
+ "code-height": editorHeight.value,
5802
+ onCopy: copyToClipboard
5803
+ }, createSlots({ _: 2 }, [_ctx.$slots.footer ? {
5804
+ name: "footer",
5805
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "footer")]),
5806
+ key: "0"
5807
+ } : void 0]), 1032, [
5808
+ "header-label",
5809
+ "sub-text-id",
5810
+ "hide-header",
5811
+ "state",
5812
+ "read-only",
5343
5813
  "sub-text",
5344
- "error",
5345
- "warning"
5346
- ])) : createCommentVNode("", true)], 2);
5814
+ "copyable",
5815
+ "copied",
5816
+ "copy-button-aria-label",
5817
+ "editor-actions",
5818
+ "focused",
5819
+ "fill",
5820
+ "code-height"
5821
+ ]);
5347
5822
  };
5348
5823
  }
5349
5824
  });
5350
5825
  //#endregion
5351
- //#region \0plugin-vue:export-helper
5352
- var _plugin_vue_export_helper_default = (sfc, props) => {
5353
- const target = sfc.__vccOpts || sfc;
5354
- for (const [key, val] of props) target[key] = val;
5355
- return target;
5356
- };
5826
+ //#region src/CodeDiffEditor/KdsCodeDiffEditor.vue?vue&type=script&setup=true&lang.ts
5827
+ var tabEscapeHint = "Press Escape followed by Tab to move focus out of the editor.";
5357
5828
  //#endregion
5358
- //#region src/CodeEditor/KdsCodeEditor.vue
5359
- var KdsCodeEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsCodeEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b08b3037"]]);
5829
+ //#region src/CodeDiffEditor/KdsCodeDiffEditor.vue
5830
+ var KdsCodeDiffEditor_default = /* @__PURE__ */ defineComponent({
5831
+ __name: "KdsCodeDiffEditor",
5832
+ props: /*@__PURE__*/ mergeModels({
5833
+ original: { default: "" },
5834
+ language: { default: "plaintext" },
5835
+ languageLabel: { default: () => void 0 },
5836
+ hideHeader: {
5837
+ type: Boolean,
5838
+ default: false
5839
+ },
5840
+ state: { default: () => kdsCodeEditorState.DEFAULT },
5841
+ sideBySide: {
5842
+ type: Boolean,
5843
+ default: true
5844
+ },
5845
+ overviewRuler: {
5846
+ type: Boolean,
5847
+ default: false
5848
+ },
5849
+ readOnly: {
5850
+ type: Boolean,
5851
+ default: false
5852
+ },
5853
+ subText: { default: () => void 0 },
5854
+ editorActions: { default: () => void 0 },
5855
+ minRows: { default: () => void 0 },
5856
+ maxRows: { default: () => void 0 },
5857
+ changeSummary: { default: () => void 0 }
5858
+ }, {
5859
+ "modelValue": { default: "" },
5860
+ "modelModifiers": {},
5861
+ "collapsed": {
5862
+ type: Boolean,
5863
+ default: false
5864
+ },
5865
+ "collapsedModifiers": {}
5866
+ }),
5867
+ emits: ["update:modelValue", "update:collapsed"],
5868
+ setup(__props, { expose: __expose }) {
5869
+ setupMonacoEnvironment();
5870
+ /** The modified content — the editable side of the diff. */
5871
+ const modelValue = useModel(__props, "modelValue");
5872
+ /**
5873
+ * Whether the editor is collapsed to just its change-summary header. Only
5874
+ * effective when `changeSummary` is set (which renders the collapse toggle).
5875
+ *
5876
+ * @default false
5877
+ */
5878
+ const collapsed = useModel(__props, "collapsed");
5879
+ const subTextId = useId();
5880
+ const baseCodeEditor = useTemplateRef("base-code-editor");
5881
+ let diffEditorInstance;
5882
+ let originalModel;
5883
+ let modifiedModel;
5884
+ let overflowWidgetsDomNode;
5885
+ const isOriginalFocused = ref(false);
5886
+ const isModifiedFocused = ref(false);
5887
+ const isEditorFocused = computed(() => isOriginalFocused.value || isModifiedFocused.value);
5888
+ const headerLabel = computed(() => __props.languageLabel ?? __props.language.toUpperCase());
5889
+ const originalAriaLabel = computed(() => `${headerLabel.value} code diff editor, original version, read-only. ${tabEscapeHint}`);
5890
+ const modifiedAriaLabel = computed(() => `${headerLabel.value} code diff editor, modified version${__props.readOnly ? ", read-only" : ""}. ${tabEscapeHint}`);
5891
+ const fillContainer = computed(() => __props.minRows === void 0 && __props.maxRows === void 0);
5892
+ const lineHeight = ref(18);
5893
+ const contentLineCount = ref(1);
5894
+ const updateContentLineCount = () => {
5895
+ contentLineCount.value = Math.max(originalModel?.getLineCount() ?? 1, modifiedModel?.getLineCount() ?? 1);
5896
+ };
5897
+ const editorHeight = computed(() => {
5898
+ if (fillContainer.value) return;
5899
+ const floor = Math.max(__props.minRows ?? 1, 1);
5900
+ const cap = __props.maxRows ?? Infinity;
5901
+ const rows = Math.min(cap, Math.max(floor, contentLineCount.value));
5902
+ return `${lineHeight.value * rows + 3}px`;
5903
+ });
5904
+ const isCollapsed = computed(() => __props.changeSummary !== void 0 && !__props.hideHeader && collapsed.value);
5905
+ const addedLineCount = ref();
5906
+ const removedLineCount = ref();
5907
+ const updateChangeCounts = () => {
5908
+ const lineChanges = diffEditorInstance?.getLineChanges();
5909
+ if (!lineChanges) return;
5910
+ let added = 0;
5911
+ let removed = 0;
5912
+ for (const change of lineChanges) {
5913
+ if (change.modifiedEndLineNumber > 0) added += change.modifiedEndLineNumber - change.modifiedStartLineNumber + 1;
5914
+ if (change.originalEndLineNumber > 0) removed += change.originalEndLineNumber - change.originalStartLineNumber + 1;
5915
+ }
5916
+ addedLineCount.value = added;
5917
+ removedLineCount.value = removed;
5918
+ };
5919
+ const { isDark } = useKdsDarkMode();
5920
+ const getAriaLabelOptions = () => ({
5921
+ originalAriaLabel: originalAriaLabel.value,
5922
+ modifiedAriaLabel: modifiedAriaLabel.value
5923
+ });
5924
+ const updateDiffEditorOptions = (options = {}) => {
5925
+ diffEditorInstance?.updateOptions({
5926
+ ...options,
5927
+ ...getAriaLabelOptions()
5928
+ });
5929
+ };
5930
+ const getModifiedInputElement = () => diffEditorInstance?.getModifiedEditor().getDomNode()?.querySelector("[role=\"textbox\"]");
5931
+ const syncEditorInputAria = () => {
5932
+ const input = getModifiedInputElement();
5933
+ if (!input) return;
5934
+ if (__props.subText) input.setAttribute("aria-describedby", subTextId);
5935
+ else input.removeAttribute("aria-describedby");
5936
+ if (__props.state === kdsCodeEditorState.ERROR) input.setAttribute("aria-invalid", "true");
5937
+ else input.removeAttribute("aria-invalid");
5938
+ };
5939
+ watch([() => __props.subText, () => __props.state], syncEditorInputAria);
5940
+ onMounted(() => {
5941
+ const container = baseCodeEditor.value?.getCodeContainer();
5942
+ if (!container) return;
5943
+ originalModel = editor.createModel(__props.original, __props.language);
5944
+ modifiedModel = editor.createModel(modelValue.value, __props.language);
5945
+ overflowWidgetsDomNode = createOverflowWidgetsDomNode();
5946
+ diffEditorInstance = editor.createDiffEditor(container, {
5947
+ ...COMMON_EDITOR_OPTIONS,
5948
+ overflowWidgetsDomNode,
5949
+ renderSideBySide: __props.sideBySide,
5950
+ renderOverviewRuler: __props.overviewRuler,
5951
+ originalEditable: false,
5952
+ readOnly: __props.readOnly,
5953
+ theme: getMonacoTheme(isDark.value)
5954
+ });
5955
+ diffEditorInstance.setModel({
5956
+ original: originalModel,
5957
+ modified: modifiedModel
5958
+ });
5959
+ diffEditorInstance.updateOptions(getAriaLabelOptions());
5960
+ syncEditorInputAria();
5961
+ diffEditorInstance.onDidUpdateDiff(updateChangeCounts);
5962
+ const modifiedEditor = diffEditorInstance.getModifiedEditor();
5963
+ const originalEditor = diffEditorInstance.getOriginalEditor();
5964
+ lineHeight.value = modifiedEditor.getOption(editor.EditorOption.lineHeight);
5965
+ updateContentLineCount();
5966
+ originalModel.onDidChangeContent(updateContentLineCount);
5967
+ modifiedModel.onDidChangeContent(() => {
5968
+ const value = modifiedModel?.getValue() ?? "";
5969
+ updateContentLineCount();
5970
+ if (value !== modelValue.value) modelValue.value = value;
5971
+ });
5972
+ for (const editorSide of [originalEditor, modifiedEditor]) setupTabFocusHandling(editorSide);
5973
+ originalEditor.onDidFocusEditorText(() => {
5974
+ isOriginalFocused.value = true;
5975
+ });
5976
+ originalEditor.onDidBlurEditorText(() => {
5977
+ isOriginalFocused.value = false;
5978
+ });
5979
+ modifiedEditor.onDidFocusEditorText(() => {
5980
+ isModifiedFocused.value = true;
5981
+ });
5982
+ modifiedEditor.onDidBlurEditorText(() => {
5983
+ isModifiedFocused.value = false;
5984
+ });
5985
+ });
5986
+ watch(isDark, (dark) => {
5987
+ if (diffEditorInstance) editor.setTheme(getMonacoTheme(dark));
5988
+ });
5989
+ watch(() => __props.readOnly, (isReadOnly) => {
5990
+ updateDiffEditorOptions({ readOnly: isReadOnly });
5991
+ });
5992
+ watch(modifiedAriaLabel, () => {
5993
+ updateDiffEditorOptions();
5994
+ });
5995
+ watch(() => __props.sideBySide, (renderSideBySide) => {
5996
+ updateDiffEditorOptions({ renderSideBySide });
5997
+ });
5998
+ watch(() => __props.overviewRuler, (renderOverviewRuler) => {
5999
+ updateDiffEditorOptions({ renderOverviewRuler });
6000
+ });
6001
+ watch(() => __props.language, (newLanguage) => {
6002
+ for (const model of [originalModel, modifiedModel]) if (model) editor.setModelLanguage(model, newLanguage);
6003
+ });
6004
+ watch(() => __props.original, (newOriginal) => {
6005
+ if (originalModel && newOriginal !== originalModel.getValue()) originalModel.setValue(newOriginal);
6006
+ });
6007
+ watch(modelValue, (newValue) => {
6008
+ if (modifiedModel && newValue !== modifiedModel.getValue()) {
6009
+ modifiedModel.pushStackElement();
6010
+ modifiedModel.pushEditOperations([], [{
6011
+ range: modifiedModel.getFullModelRange(),
6012
+ text: newValue ?? ""
6013
+ }], () => null);
6014
+ }
6015
+ });
6016
+ onUnmounted(() => {
6017
+ diffEditorInstance?.dispose();
6018
+ originalModel?.dispose();
6019
+ modifiedModel?.dispose();
6020
+ overflowWidgetsDomNode?.remove();
6021
+ });
6022
+ __expose({
6023
+ /** The underlying Monaco diff editor instance, available after mount. */
6024
+ getEditor: () => diffEditorInstance });
6025
+ return (_ctx, _cache) => {
6026
+ return openBlock(), createBlock(BaseCodeEditor_default, {
6027
+ ref: "base-code-editor",
6028
+ "header-label": headerLabel.value,
6029
+ "sub-text-id": unref(subTextId),
6030
+ "hide-header": __props.hideHeader,
6031
+ state: __props.state,
6032
+ "read-only": __props.readOnly,
6033
+ "sub-text": __props.subText,
6034
+ copyable: false,
6035
+ "editor-actions": __props.editorActions,
6036
+ focused: isEditorFocused.value,
6037
+ fill: fillContainer.value,
6038
+ "code-height": editorHeight.value,
6039
+ "change-summary": __props.changeSummary,
6040
+ "added-lines": addedLineCount.value,
6041
+ "removed-lines": removedLineCount.value,
6042
+ collapsed: isCollapsed.value,
6043
+ onCollapsedToggle: _cache[0] || (_cache[0] = ($event) => collapsed.value = !collapsed.value)
6044
+ }, null, 8, [
6045
+ "header-label",
6046
+ "sub-text-id",
6047
+ "hide-header",
6048
+ "state",
6049
+ "read-only",
6050
+ "sub-text",
6051
+ "editor-actions",
6052
+ "focused",
6053
+ "fill",
6054
+ "code-height",
6055
+ "change-summary",
6056
+ "added-lines",
6057
+ "removed-lines",
6058
+ "collapsed"
6059
+ ]);
6060
+ };
6061
+ }
6062
+ });
5360
6063
  //#endregion
5361
6064
  //#region src/Console/utils/buildTheme.ts
5362
6065
  /**
@@ -5564,6 +6267,6 @@ var KdsConsole_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
5564
6267
  }
5565
6268
  }), [["__scopeId", "data-v-646b2bdc"]]);
5566
6269
  //#endregion
5567
- export { KdsCodeEditor_default as KdsCodeEditor, KdsConsole_default as KdsConsole, kdsCodeEditorState, kdsCodeEditorStates, setupMonacoEnvironment };
6270
+ export { KdsCodeDiffEditor_default as KdsCodeDiffEditor, KdsCodeEditor_default as KdsCodeEditor, KdsConsole_default as KdsConsole, kdsCodeEditorState, kdsCodeEditorStates, setupMonacoEnvironment };
5568
6271
 
5569
6272
  //# sourceMappingURL=index.js.map