A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Added Monaco Editor.
Etienne Baudouxd424024417c0
diff --git a/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.js b/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.jsindex 448cb499f..78bbd5ab4 100644--- a/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.js+++ b/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.js@@ -1,3 +1,4 @@export { default as DOM } from "./dom";export { default as Popover } from "./popover";+export { default as MonacoEditor } from "./monacoEditor";//# sourceMappingURL=index.esm.js.map\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.ts b/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.tsindex 678d1fa72..c4175241b 100644--- a/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.ts+++ b/src/app/dev/DevToys.Blazor/Assets/javascript/index.esm.ts@@ -1,2 +1,3 @@export { default as DOM } from "./dom";-export { default as Popover } from "./popover";\ No newline at end of file+export { default as Popover } from "./popover";+export { default as MonacoEditor } from "./monacoEditor";\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Assets/javascript/monacoEditor.js b/src/app/dev/DevToys.Blazor/Assets/javascript/monacoEditor.jsnew file mode 100644index 000000000..fa8bde034--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Assets/javascript/monacoEditor.js@@ -0,0 +1,829 @@+// eslint-disable-next-line @typescript-eslint/triple-slash-reference+///<reference path="../../node_modules/monaco-editor/monaco.d.ts" />+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }+ return new (P || (P = Promise))(function (resolve, reject) {+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }+ step((generator = generator.apply(thisArg, _arguments || [])).next());+ });+};+class MonacoEditorHolder {+}+class MonacoEditor {+ // create a new instance of Monaco Editor.+ static create(id, options, override, dotNetObjRef) {+ if (options == null) {+ options = {};+ }+ const oldEditor = MonacoEditor.getStandaloneCodeEditor(id, true);+ if (oldEditor != null) {+ options.value = oldEditor.getValue();+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id == id), 1);+ oldEditor.dispose();+ }+ if (typeof monaco === "undefined") {+ throw new Error("Error : Monaco Editor library isn't loaded.");+ }+ const newEditor = monaco.editor.create(document.getElementById(id), options, override);+ MonacoEditor.editors.push({+ id: id,+ editor: newEditor,+ dotNetObjRef: dotNetObjRef,+ isDiffEditor: false+ });+ }+ // create a new instance of Diff Monaco Editor.+ static createDiffEditor(id, options, override, dotNetObjRef, dotNetObjRefOriginal, dotNetObjRefModified) {+ if (options == null) {+ options = {};+ }+ const oldEditor = MonacoEditor.getStandaloneDiffEditor(id, true);+ let oldModel = null;+ if (oldEditor !== null) {+ oldModel = oldEditor.getModel();+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id === id + "_original"), 1);+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id === id + "_modified"), 1);+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id === id), 1);+ oldEditor.dispose();+ }+ if (typeof monaco === "undefined") {+ throw new Error("Error : Monaco Editor library isn't loaded.");+ }+ const editor = monaco.editor.createDiffEditor(document.getElementById(id), options, override);+ MonacoEditor.editors.push({+ id: id,+ editor: editor,+ dotNetObjRef: dotNetObjRef,+ isDiffEditor: true+ });+ MonacoEditor.editors.push({+ id: id + "_original",+ editor: editor.getOriginalEditor(),+ dotNetObjRef: dotNetObjRefOriginal,+ isDiffEditor: false+ });+ MonacoEditor.editors.push({+ id: id + "_modified",+ editor: editor.getModifiedEditor(),+ dotNetObjRef: dotNetObjRefModified,+ isDiffEditor: false+ });+ if (oldModel !== null)+ editor.setModel(oldModel);+ }+ static createModel(value, language, uriStr) {+ // uri is the key; if no uri exists create one+ if (uriStr == null || uriStr == "") {+ uriStr = "generatedUriKey_" + this.uuidv4();+ }+ const uri = monaco.Uri.parse(uriStr);+ const model = monaco.editor.createModel(value, language, uri);+ if (model == null) {+ return null;+ }+ return {+ id: model.id,+ uri: model.uri.toString()+ };+ }+ // dipose an editor.+ static dispose(id) {+ var _a;+ (_a = this.getEditor(id)) === null || _a === void 0 ? void 0 : _a.dispose();+ }+ // update options.+ static updateOptions(id, options) {+ var _a;+ (_a = this.getEditor(id)) === null || _a === void 0 ? void 0 : _a.updateOptions(options);+ }+ // set value.+ static setValue(id, value) {+ var _a;+ (_a = this.getStandaloneCodeEditor(id)) === null || _a === void 0 ? void 0 : _a.setValue(value);+ }+ // get value.+ static getValue(id, preserveBOM, lineEnding) {+ const editor = this.getStandaloneCodeEditor(id);+ let options = null;+ if (preserveBOM != null && lineEnding != null) {+ options = {+ preserveBOM: preserveBOM,+ lineEnding: lineEnding+ };+ }+ return editor.getValue(options);+ }+ static colorize(text, languageId, options) {+ return __awaiter(this, void 0, void 0, function* () {+ const promise = monaco.editor.colorize(text, languageId, options);+ return yield promise;+ });+ }+ static colorizeElement(elementId, options) {+ return __awaiter(this, void 0, void 0, function* () {+ const promise = monaco.editor.colorizeElement(document.getElementById(elementId), options);+ return yield promise;+ });+ }+ static colorizeModelLine(uriStr, lineNumber, tabSize) {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return null;+ }+ return monaco.editor.colorizeModelLine(model, lineNumber, tabSize);+ }+ static defineTheme(themeName, themeData) {+ monaco.editor.defineTheme(themeName, themeData);+ }+ static getModel(uriStr) {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return null;+ }+ return {+ id: model.id,+ uri: model.uri.toString()+ };+ }+ static getModels() {+ return monaco.editor.getModels().map(function (value) {+ return {+ id: value.id,+ uri: value.uri.toString()+ };+ });+ }+ static remeasureFonts() {+ monaco.editor.remeasureFonts();+ }+ static setModelLanguage(uriStr, languageId) {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return null;+ }+ monaco.editor.setModelLanguage(model, languageId);+ }+ static setTheme(theme) {+ monaco.editor.setTheme(theme);+ return true;+ }+ static addAction(id, actionDescriptor) {+ const editorHolder = this.getEditorHolder(id);+ editorHolder.editor.addAction({+ id: actionDescriptor.id,+ label: actionDescriptor.label,+ keybindings: actionDescriptor.keybindings,+ precondition: actionDescriptor.precondition,+ keybindingContext: actionDescriptor.keybindingContext,+ contextMenuGroupId: actionDescriptor.contextMenuGroupId,+ contextMenuOrder: actionDescriptor.contextMenuOrder,+ run(editor, args) {+ editorHolder.dotNetObjRef.invokeMethodAsync("ActionCallback", actionDescriptor.id);+ }+ });+ }+ static addCommand(id, keybinding, context) {+ const editorHolder = this.getEditorHolder(id);+ editorHolder.editor.addCommand(keybinding, function (args) {+ editorHolder.dotNetObjRef.invokeMethodAsync("CommandCallback", keybinding);+ }, context);+ }+ static deltaDecorations(id, oldDecorations, newDecorations) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.deltaDecorations(oldDecorations, newDecorations);+ }+ static focus(id) {+ const editor = this.getEditor(id);+ editor.focus();+ }+ static executeEdits(id, source, edits, endCursorState) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.executeEdits(source, edits, endCursorState);+ }+ static getContainerDomNodeId(id) {+ const editor = this.getStandaloneCodeEditor(id);+ const containerNode = editor.getContainerDomNode();+ if (containerNode == null) {+ return null;+ }+ return containerNode.id;+ }+ static getContentHeight(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getContentHeight();+ }+ static getContentWidth(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getContentWidth();+ }+ static getDomNodeId(id) {+ const editor = this.getStandaloneCodeEditor(id);+ const domeNode = editor.getDomNode();+ if (domeNode == null) {+ return null;+ }+ return domeNode.id;+ }+ static getEditorType(id) {+ const editor = this.getEditor(id);+ return editor.getEditorType();+ }+ static getInstanceModel(id) {+ const editor = this.getEditor(id);+ const model = editor.getModel();+ if (model == null) {+ return null;+ }+ return {+ id: model.id,+ uri: model.uri.toString()+ };+ }+ static getInstanceDiffModel(id) {+ const editor = this.getEditor(id);+ const model = editor.getModel();+ if (model == null) {+ return null;+ }+ return {+ original: {+ id: model.original.id,+ uri: model.original.uri.toString()+ },+ modified: {+ id: model.modified.id,+ uri: model.modified.uri.toString()+ }+ };+ }+ static getLayoutInfo(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getLayoutInfo();+ }+ static getOffsetForColumn(id, lineNumber, column) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getOffsetForColumn(lineNumber, column);+ }+ static getOption(id, optionId) {+ const editor = this.getStandaloneCodeEditor(id);+ return JSON.stringify(editor.getOption(optionId));+ }+ static getOptions(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getOptions()._values.map(function (value) {+ return JSON.stringify(value);+ });+ }+ static getPosition(id) {+ const editor = this.getEditor(id);+ return editor.getPosition();+ }+ static getRawOptions(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getRawOptions();+ }+ static getScrollHeight(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollHeight();+ }+ static getScrollLeft(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollLeft();+ }+ static getScrollTop(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollTop();+ }+ static getScrollWidth(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollWidth();+ }+ static getScrolledVisiblePosition(id, position) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrolledVisiblePosition(position);+ }+ static getSelection(id) {+ const editor = this.getEditor(id);+ return editor.getSelection();+ }+ static getSelections(id) {+ const editor = this.getEditor(id);+ return editor.getSelections();+ }+ static getTargetAtClientPoint(id, clientX, clientY) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getTargetAtClientPoint(clientX, clientY);+ }+ static getTopForLineNumber(id, lineNumber) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getTopForLineNumber(lineNumber);+ }+ static getTopForPosition(id, lineNumber, column) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getTopForPosition(lineNumber, column);+ }+ static getVisibleColumnFromPosition(id, position) {+ const editor = this.getEditor(id);+ return editor.getVisibleColumnFromPosition(position);+ }+ static getVisibleRanges(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getVisibleRanges();+ }+ static hasTextFocus(id) {+ const editor = this.getEditor(id);+ return editor.hasTextFocus();+ }+ static hasWidgetFocus(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.hasWidgetFocus();+ }+ static layout(id, dimension) {+ const editor = this.getEditor(id);+ editor.layout(dimension);+ }+ static pushUndoStop(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.pushUndoStop();+ }+ static popUndoStop(id) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.popUndoStop();+ }+ static render(id, forceRedraw) {+ const editor = this.getStandaloneCodeEditor(id);+ editor.render(forceRedraw);+ }+ static revealLine(id, lineNumber, scrollType) {+ const editor = this.getEditor(id);+ editor.revealLine(lineNumber, scrollType);+ }+ static revealLineInCenter(id, lineNumber, scrollType) {+ const editor = this.getEditor(id);+ editor.revealLineInCenter(lineNumber, scrollType);+ }+ static revealLineInCenterIfOutsideViewport(id, lineNumber, scrollType) {+ const editor = this.getEditor(id);+ editor.revealLineInCenterIfOutsideViewport(lineNumber, scrollType);+ }+ static revealLines(id, startLineNumber, endLineNumber, scrollType) {+ const editor = this.getEditor(id);+ editor.revealLines(startLineNumber, endLineNumber, scrollType);+ }+ static revealLinesInCenter(id, startLineNumber, endLineNumber, scrollType) {+ const editor = this.getEditor(id);+ editor.revealLinesInCenter(startLineNumber, endLineNumber, scrollType);+ }+ static revealLinesInCenterIfOutsideViewport(id, startLineNumber, endLineNumber, scrollType) {+ const editor = this.getEditor(id);+ editor.revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType);+ }+ static revealPosition(id, position, scrollType) {+ const editor = this.getEditor(id);+ editor.revealPosition(position, scrollType);+ }+ static revealPositionInCenter(id, position, scrollType) {+ const editor = this.getEditor(id);+ editor.revealPositionInCenter(position, scrollType);+ }+ static revealPositionInCenterIfOutsideViewport(id, position, scrollType) {+ const editor = this.getEditor(id);+ editor.revealPositionInCenterIfOutsideViewport(position, scrollType);+ }+ static revealRange(id, range, scrollType) {+ const editor = this.getEditor(id);+ editor.revealRange(range, scrollType);+ }+ static revealRangeAtTop(id, range, scrollType) {+ const editor = this.getEditor(id);+ editor.revealRangeAtTop(range, scrollType);+ }+ static revealRangeInCenter(id, range, scrollType) {+ const editor = this.getEditor(id);+ editor.revealRangeInCenter(range, scrollType);+ }+ static revealRangeInCenterIfOutsideViewport(id, range, scrollType) {+ const editor = this.getEditor(id);+ editor.revealRangeInCenterIfOutsideViewport(range, scrollType);+ }+ static setEventListener(id, eventName) {+ const editorHolder = this.getEditorHolder(id);+ const editor = editorHolder.editor;+ const dotNetObjRef = editorHolder.dotNetObjRef;+ const listener = function (e) {+ let eventJson = JSON.stringify(e);+ if (eventName == "OnDidChangeModel") {+ const eStrong = e;+ eventJson = JSON.stringify({+ oldModelUri: eStrong.oldModelUrl == null ? null : eStrong.oldModelUrl.toString(),+ newModelUri: eStrong.newModelUrl == null ? null : eStrong.newModelUrl.toString(),+ });+ }+ else if (eventName == "OnDidChangeConfiguration") {+ const eStrong = e;+ eventJson = JSON.stringify(eStrong._values);+ }+ dotNetObjRef.invokeMethodAsync("EventCallback", eventName, eventJson);+ };+ switch (eventName) {+ case "OnDidCompositionEnd":+ editor.onDidCompositionEnd(listener);+ break;+ case "OnDidCompositionStart":+ editor.onDidCompositionStart(listener);+ break;+ case "OnContextMenu":+ editor.onContextMenu(listener);+ break;+ case "OnDidBlurEditorText":+ editor.onDidBlurEditorText(listener);+ break;+ case "OnDidBlurEditorWidget":+ editor.onDidBlurEditorWidget(listener);+ break;+ case "OnDidChangeConfiguration":+ editor.onDidChangeConfiguration(listener);+ break;+ case "OnDidChangeCursorPosition":+ editor.onDidChangeCursorPosition(listener);+ break;+ case "OnDidChangeCursorSelection":+ editor.onDidChangeCursorSelection(listener);+ break;+ case "OnDidChangeModel":+ editor.onDidChangeModel(listener);+ break;+ case "OnDidChangeModelContent":+ editor.onDidChangeModelContent(listener);+ break;+ case "OnDidChangeModelDecorations":+ editor.onDidChangeModelDecorations(listener);+ break;+ case "OnDidChangeModelLanguage":+ editor.onDidChangeModelLanguage(listener);+ break;+ case "OnDidChangeModelLanguageConfiguration":+ editor.onDidChangeModelLanguageConfiguration(listener);+ break;+ case "OnDidChangeModelOptions":+ editor.onDidChangeModelOptions(listener);+ break;+ case "OnDidContentSizeChange":+ editor.onDidContentSizeChange(listener);+ break;+ case "OnDidDispose":+ editor.onDidDispose(listener);+ break;+ case "OnDidFocusEditorText":+ editor.onDidFocusEditorText(listener);+ break;+ case "OnDidFocusEditorWidget":+ editor.onDidFocusEditorWidget(listener);+ break;+ case "OnDidLayoutChange":+ editor.onDidLayoutChange(listener);+ break;+ case "OnDidPaste":+ editor.onDidPaste(listener);+ break;+ case "OnDidScrollChange":+ editor.onDidScrollChange(listener);+ break;+ case "OnKeyDown":+ editor.onKeyDown(listener);+ break;+ case "OnKeyUp":+ editor.onKeyUp(listener);+ break;+ case "OnMouseDown":+ editor.onMouseDown(listener);+ break;+ case "OnMouseLeave":+ editor.onMouseLeave(listener);+ break;+ case "OnMouseMove":+ editor.onMouseMove(listener);+ break;+ case "OnMouseUp":+ editor.onMouseUp(listener);+ break;+ }+ }+ static setInstanceModel(id, uriStr) {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return;+ }+ const editor = this.getEditor(id);+ editor.setModel(model);+ }+ static setInstanceDiffModel(id, model) {+ const original_model = MonacoEditor.TextModel.getModel(model.original.uri.toString());+ const modified_model = MonacoEditor.TextModel.getModel(model.modified.uri.toString());+ if (original_model == null || modified_model == null) {+ return;+ }+ const editor = this.getEditor(id);+ editor.setModel({+ original: original_model,+ modified: modified_model,+ });+ }+ static setPosition(id, position) {+ const editor = this.getEditor(id);+ editor.setPosition(position);+ }+ static setScrollLeft(id, newScrollLeft, scrollType) {+ const editor = this.getStandaloneCodeEditor(id);+ editor.setScrollLeft(newScrollLeft, scrollType);+ }+ static setScrollPosition(id, newPosition, scrollType) {+ const editor = this.getStandaloneCodeEditor(id);+ editor.setScrollPosition(newPosition, scrollType);+ }+ static setScrollTop(id, newScrollTop, scrollType) {+ const editor = this.getStandaloneCodeEditor(id);+ editor.setScrollTop(newScrollTop, scrollType);+ }+ static setSelection(id, selection) {+ const editor = this.getEditor(id);+ editor.setSelection(selection);+ }+ static setSelections(id, selections) {+ const editor = this.getEditor(id);+ editor.setSelections(selections);+ }+ static trigger(id, source, handlerId, payload) {+ const editor = this.getEditor(id);+ editor.trigger(source, handlerId, payload);+ }+ static uuidv4() {+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {+ const r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);+ return v.toString(16);+ });+ }+ static getEditor(id, unobstrusive = false) {+ const editorHolder = MonacoEditor.getEditorHolder(id, unobstrusive);+ return editorHolder == null ? null : editorHolder.editor;+ }+ static getStandaloneCodeEditor(id, unobstrusive = false) {+ const editorHolder = MonacoEditor.getEditorHolder(id, unobstrusive);+ if (editorHolder === null) {+ return null;+ }+ if (editorHolder.isDiffEditor) {+ throw "Code editor was expected but a Diff editor has been found.";+ }+ return editorHolder.editor;+ }+ static getStandaloneDiffEditor(id, unobstrusive = false) {+ const editorHolder = MonacoEditor.getEditorHolder(id, unobstrusive);+ if (editorHolder === null) {+ return null;+ }+ if (!editorHolder.isDiffEditor) {+ throw "Diff editor was expected but a Code editor has been found.";+ }+ return editorHolder.editor;+ }+ static getEditorHolder(id, unobstrusive = false) {+ const editorHolder = MonacoEditor.editors.find(e => e.id === id);+ if (!editorHolder) {+ if (unobstrusive) {+ console.log("WARNING : Couldn't find the editor with id: " + id + " editors.length: " + MonacoEditor.editors.length);+ return null;+ }+ throw "Couldn't find the editor with id: " + id + " editors.length: " + MonacoEditor.editors.length;+ }+ else if (!editorHolder.editor) {+ if (unobstrusive) {+ console.log("WARNING : editor is null for editorHolder: " + editorHolder);+ return null;+ }+ throw "editor is null for editorHolder: " + editorHolder;+ }+ return editorHolder;+ }+}+// list of editor instances+MonacoEditor.editors = [];+// constructor+(() => {+ // this will force loading the monaco library. It happens on the app startup.+ require.config({ paths: { "vs": "_content/DevToys.Blazor/lib/monaco-editor/min/vs" } });+ require(["vs/editor/editor.main"]);+})();+MonacoEditor.TextModel = class {+ static getModel(uriStr) {+ const uri = monaco.Uri.parse(uriStr);+ if (uri == null) {+ return null;+ }+ return monaco.editor.getModel(uri);+ }+ static getOptions(uriStr) {+ const model = this.getModel(uriStr);+ return model.getOptions();+ }+ static getVersionId(uriStr) {+ const model = this.getModel(uriStr);+ return model.getVersionId();+ }+ static getAlternativeVersionId(uriStr) {+ const model = this.getModel(uriStr);+ return model.getAlternativeVersionId();+ }+ static setValue(uriStr, newValue) {+ const model = this.getModel(uriStr);+ model.setValue(newValue);+ }+ static getValue(uriStr, eol, preserveBOM) {+ const model = this.getModel(uriStr);+ return model.getValue(eol, preserveBOM);+ }+ static getValueLength(uriStr, eol, preserveBOM) {+ const model = this.getModel(uriStr);+ return model.getValueLength(eol, preserveBOM);+ }+ static getValueInRange(uriStr, range, eol) {+ const model = this.getModel(uriStr);+ return model.getValueInRange(range, eol);+ }+ static getValueLengthInRange(uriStr, range) {+ const model = this.getModel(uriStr);+ return model.getValueLengthInRange(range);+ }+ static getCharacterCountInRange(uriStr, range) {+ const model = this.getModel(uriStr);+ return model.getCharacterCountInRange(range);+ }+ static getLineCount(uriStr) {+ const model = this.getModel(uriStr);+ return model.getLineCount();+ }+ static getLineContent(uriStr, lineNumber) {+ const model = this.getModel(uriStr);+ return model.getLineContent(lineNumber);+ }+ static getLineLength(uriStr, lineNumber) {+ const model = this.getModel(uriStr);+ return model.getLineLength(lineNumber);+ }+ static getLinesContent(uriStr) {+ const model = this.getModel(uriStr);+ return model.getLinesContent();+ }+ static getEOL(uriStr) {+ const model = this.getModel(uriStr);+ return model.getEOL();+ }+ static getEndOfLineSequence(uriStr) {+ const model = this.getModel(uriStr);+ return model.getEndOfLineSequence();+ }+ static getLineMinColumn(uriStr, lineNumber) {+ const model = this.getModel(uriStr);+ return model.getLineMinColumn(lineNumber);+ }+ static getLineMaxColumn(uriStr, lineNumber) {+ const model = this.getModel(uriStr);+ return model.getLineMaxColumn(lineNumber);+ }+ static getLineFirstNonWhitespaceColumn(uriStr, lineNumber) {+ const model = this.getModel(uriStr);+ return model.getLineFirstNonWhitespaceColumn(lineNumber);+ }+ static getLineLastNonWhitespaceColumn(uriStr, lineNumber) {+ const model = this.getModel(uriStr);+ return model.getLineLastNonWhitespaceColumn(lineNumber);+ }+ static validatePosition(uriStr, position) {+ const model = this.getModel(uriStr);+ return model.validatePosition(position);+ }+ static modifyPosition(uriStr, position, offset) {+ const model = this.getModel(uriStr);+ return model.modifyPosition(position, offset);+ }+ static validateRange(uriStr, range) {+ const model = this.getModel(uriStr);+ return model.validateRange(range);+ }+ static getOffsetAt(uriStr, position) {+ const model = this.getModel(uriStr);+ return model.getOffsetAt(position);+ }+ static getPositionAt(uriStr, offset) {+ const model = this.getModel(uriStr);+ return model.getPositionAt(offset);+ }+ static getFullModelRange(uriStr) {+ const model = this.getModel(uriStr);+ return model.getFullModelRange();+ }+ static isDisposed(uriStr) {+ const model = this.getModel(uriStr);+ return model.isDisposed();+ }+ static findMatches(uriStr, searchString, searchScope_or_searchOnlyEditableRange, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount) {+ const model = this.getModel(uriStr);+ return model.findMatches(searchString, searchScope_or_searchOnlyEditableRange, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount);+ }+ static findNextMatch(uriStr, searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches) {+ const model = this.getModel(uriStr);+ return model.findNextMatch(searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches);+ }+ static findPreviousMatch(uriStr, searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches) {+ const model = this.getModel(uriStr);+ return model.findPreviousMatch(searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches);+ }+ static getLanguageId(uriStr) {+ const model = this.getModel(uriStr);+ return model.getLanguageId();+ }+ static getWordAtPosition(uriStr, position) {+ const model = this.getModel(uriStr);+ return model.getWordAtPosition(position);+ }+ static getWordUntilPosition(uriStr, position) {+ const model = this.getModel(uriStr);+ return model.getWordUntilPosition(position);+ }+ static deltaDecorations(uriStr, oldDecorations, newDecorations, ownerId) {+ const model = this.getModel(uriStr);+ return model.deltaDecorations(oldDecorations, newDecorations, ownerId);+ }+ static getDecorationOptions(uriStr, id) {+ const model = this.getModel(uriStr);+ return model.getDecorationOptions(id);+ }+ static getDecorationRange(uriStr, id) {+ const model = this.getModel(uriStr);+ return model.getDecorationRange(id);+ }+ static getLineDecorations(uriStr, lineNumber, ownerId, filterOutValidation) {+ const model = this.getModel(uriStr);+ return model.getLineDecorations(lineNumber, ownerId, filterOutValidation);+ }+ static getLinesDecorations(uriStr, startLineNumber, endLineNumber, ownerId, filterOutValidation) {+ const model = this.getModel(uriStr);+ return model.getLinesDecorations(startLineNumber, endLineNumber, ownerId, filterOutValidation);+ }+ static getDecorationsInRange(uriStr, range, ownerId, filterOutValidation) {+ const model = this.getModel(uriStr);+ return model.getDecorationsInRange(range, ownerId, filterOutValidation);+ }+ static getAllDecorations(uriStr, ownerId, filterOutValidation) {+ const model = this.getModel(uriStr);+ return model.getAllDecorations(ownerId, filterOutValidation);+ }+ static getInjectedTextDecorations(uriStr, ownerId) {+ const model = this.getModel(uriStr);+ return model.getInjectedTextDecorations(ownerId);+ }+ static getOverviewRulerDecorations(uriStr, ownerId, filterOutValidation) {+ const model = this.getModel(uriStr);+ return model.getOverviewRulerDecorations(ownerId, filterOutValidation);+ }+ static normalizeIndentation(uriStr, str) {+ const model = this.getModel(uriStr);+ return model.normalizeIndentation(str);+ }+ static updateOptions(uriStr, newOpts) {+ const model = this.getModel(uriStr);+ return model.updateOptions(newOpts);+ }+ static detectIndentation(uriStr, defaultInsertSpaces, defaultTabSize) {+ const model = this.getModel(uriStr);+ model.detectIndentation(defaultInsertSpaces, defaultTabSize);+ }+ static pushStackElement(uriStr) {+ const model = this.getModel(uriStr);+ model.pushStackElement();+ }+ static popStackElement(uriStr) {+ const model = this.getModel(uriStr);+ model.popStackElement();+ }+ static pushEOL(uriStr, eol) {+ const model = this.getModel(uriStr);+ model.pushEOL(eol);+ }+ static applyEdits(uriStr, operations, computeUndoEdits) {+ const model = this.getModel(uriStr);+ model.applyEdits(operations, computeUndoEdits);+ }+ static setEOL(uriStr, eol) {+ const model = this.getModel(uriStr);+ model.setEOL(eol);+ }+ static dispose(uriStr) {+ const model = this.getModel(uriStr);+ model.dispose();+ }+};+export default MonacoEditor;+//# sourceMappingURL=monacoEditor.js.map\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Assets/javascript/monacoEditor.ts b/src/app/dev/DevToys.Blazor/Assets/javascript/monacoEditor.tsnew file mode 100644index 000000000..804022304--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Assets/javascript/monacoEditor.ts@@ -0,0 +1,1058 @@+// eslint-disable-next-line @typescript-eslint/triple-slash-reference+///<reference path="../../node_modules/monaco-editor/monaco.d.ts" />++// eslint-disable-next-line @typescript-eslint/no-explicit-any+declare const require: any;++class MonacoEditorHolder {+ public id: string;+ public editor: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;+ public dotNetObjRef: DotNet.DotNetObject;+ public isDiffEditor: boolean;+}++class MonacoEditor {+ // list of editor instances+ private static editors: MonacoEditorHolder[] = [];++ // constructor+ static {+ // this will force loading the monaco library. It happens on the app startup.+ require.config({ paths: { "vs": "_content/DevToys.Blazor/lib/monaco-editor/min/vs" } });+ require(["vs/editor/editor.main"]);+ }++ // create a new instance of Monaco Editor.+ public static create(+ id: string,+ options: monaco.editor.IStandaloneEditorConstructionOptions,+ override: monaco.editor.IEditorOverrideServices,+ dotNetObjRef: DotNet.DotNetObject): void {+ if (options == null) {+ options = {};+ }++ const oldEditor = MonacoEditor.getStandaloneCodeEditor(id, true);+ if (oldEditor != null) {+ options.value = oldEditor.getValue();+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id == id), 1);+ oldEditor.dispose();+ }++ if (typeof monaco === "undefined") {+ throw new Error("Error : Monaco Editor library isn't loaded.");+ }++ const newEditor = monaco.editor.create(document.getElementById(id), options, override);+ MonacoEditor.editors.push({+ id: id,+ editor: newEditor,+ dotNetObjRef: dotNetObjRef,+ isDiffEditor: false+ });+ }++ // create a new instance of Diff Monaco Editor.+ public static createDiffEditor(+ id: string,+ options: monaco.editor.IStandaloneDiffEditorConstructionOptions,+ override: monaco.editor.IEditorOverrideServices,+ dotNetObjRef: DotNet.DotNetObject,+ dotNetObjRefOriginal: DotNet.DotNetObject,+ dotNetObjRefModified: DotNet.DotNetObject): void {+ if (options == null) {+ options = {};+ }++ const oldEditor = MonacoEditor.getStandaloneDiffEditor(id, true);+ let oldModel: monaco.editor.IDiffEditorModel = null;+ if (oldEditor !== null) {+ oldModel = oldEditor.getModel();++ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id === id + "_original"), 1);+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id === id + "_modified"), 1);+ MonacoEditor.editors.splice(MonacoEditor.editors.findIndex(item => item.id === id), 1);+ oldEditor.dispose();+ }++ if (typeof monaco === "undefined") {+ throw new Error("Error : Monaco Editor library isn't loaded.");+ }++ const editor = monaco.editor.createDiffEditor(document.getElementById(id), options, override);+ MonacoEditor.editors.push({+ id: id,+ editor: editor,+ dotNetObjRef: dotNetObjRef,+ isDiffEditor: true+ });+ MonacoEditor.editors.push({+ id: id + "_original",+ editor: editor.getOriginalEditor(),+ dotNetObjRef: dotNetObjRefOriginal,+ isDiffEditor: false+ });+ MonacoEditor.editors.push({+ id: id + "_modified",+ editor: editor.getModifiedEditor(),+ dotNetObjRef: dotNetObjRefModified,+ isDiffEditor: false+ });++ if (oldModel !== null)+ editor.setModel(oldModel);+ }++ public static createModel(value: string, language: string, uriStr: string) {+ // uri is the key; if no uri exists create one+ if (uriStr == null || uriStr == "") {+ uriStr = "generatedUriKey_" + this.uuidv4();+ }++ const uri = monaco.Uri.parse(uriStr);+ const model = monaco.editor.createModel(value, language, uri);+ if (model == null) {+ return null;+ }++ return {+ id: model.id,+ uri: model.uri.toString()+ };+ }++ // dipose an editor.+ public static dispose(id: string): void {+ this.getEditor(id)?.dispose();+ }++ // update options.+ public static updateOptions(id: string, options: monaco.editor.IEditorOptions & monaco.editor.IGlobalEditorOptions): void {+ this.getEditor(id)?.updateOptions(options);+ }++ // set value.+ public static setValue(id: string, value: string): void {+ this.getStandaloneCodeEditor(id)?.setValue(value);+ }++ // get value.+ public static getValue(id: string, preserveBOM?: boolean, lineEnding?: string): string {+ const editor = this.getStandaloneCodeEditor(id);+ let options = null;+ if (preserveBOM != null && lineEnding != null) {+ options = {+ preserveBOM: preserveBOM,+ lineEnding: lineEnding+ };+ }+ return editor.getValue(options);+ }++ public static async colorize(text: string, languageId: string, options: monaco.editor.IColorizerOptions): Promise<string> {+ const promise = monaco.editor.colorize(text, languageId, options);+ return await promise;+ }++ public static async colorizeElement(elementId: string, options: monaco.editor.IColorizerOptions): Promise<void> {+ const promise = monaco.editor.colorizeElement(document.getElementById(elementId), options);+ return await promise;+ }++ public static colorizeModelLine(uriStr: string, lineNumber: number, tabSize?: number): string {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return null;+ }+ return monaco.editor.colorizeModelLine(model, lineNumber, tabSize);+ }++ public static defineTheme(themeName: string, themeData: monaco.editor.IStandaloneThemeData): void {+ monaco.editor.defineTheme(themeName, themeData);+ }++ public static getModel(uriStr: string) {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return null;+ }++ return {+ id: model.id,+ uri: model.uri.toString()+ };+ }++ public static getModels() {+ return monaco.editor.getModels().map(function (value) {+ return {+ id: value.id,+ uri: value.uri.toString()+ };+ });+ }++ public static remeasureFonts(): void {+ monaco.editor.remeasureFonts();+ }++ public static setModelLanguage(uriStr: string, languageId: string): void {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return null;+ }+ monaco.editor.setModelLanguage(model, languageId);+ }++ public static setTheme(theme: string): boolean {+ monaco.editor.setTheme(theme);+ return true;+ }+++ public static addAction(id: string, actionDescriptor: monaco.editor.IActionDescriptor): void {+ const editorHolder = this.getEditorHolder(id);+ editorHolder.editor.addAction({+ id: actionDescriptor.id,+ label: actionDescriptor.label,+ keybindings: actionDescriptor.keybindings,+ precondition: actionDescriptor.precondition,+ keybindingContext: actionDescriptor.keybindingContext,+ contextMenuGroupId: actionDescriptor.contextMenuGroupId,+ contextMenuOrder: actionDescriptor.contextMenuOrder,+ run(editor, args) {+ editorHolder.dotNetObjRef.invokeMethodAsync("ActionCallback", actionDescriptor.id);+ }+ });+ }++ public static addCommand(id: string, keybinding: number, context?: string): void {+ const editorHolder = this.getEditorHolder(id);+ editorHolder.editor.addCommand(keybinding, function (args: any[]): void {+ editorHolder.dotNetObjRef.invokeMethodAsync("CommandCallback", keybinding);+ }, context);+ }++ public static deltaDecorations(id: string, oldDecorations: string[], newDecorations: monaco.editor.IModelDeltaDecoration[]): string[] {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.deltaDecorations(oldDecorations, newDecorations);+ }++ public static focus(id: string): void {+ const editor = this.getEditor(id);+ editor.focus();+ }++ public static executeEdits(id: string, source: string, edits: monaco.editor.IIdentifiedSingleEditOperation[], endCursorState?: monaco.editor.ICursorStateComputer): boolean {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.executeEdits(source, edits, endCursorState);+ }++ public static getContainerDomNodeId(id: string): string {+ const editor = this.getStandaloneCodeEditor(id);+ const containerNode = editor.getContainerDomNode();+ if (containerNode == null) {+ return null;+ }+ return containerNode.id;+ }++ public static getContentHeight(id: string): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getContentHeight();+ }++ public static getContentWidth(id: string): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getContentWidth();+ }++ public static getDomNodeId(id: string): string {+ const editor = this.getStandaloneCodeEditor(id);+ const domeNode = editor.getDomNode();+ if (domeNode == null) {+ return null;+ }+ return domeNode.id;+ }++ public static getEditorType(id: string): string {+ const editor = this.getEditor(id);+ return editor.getEditorType();+ }++ public static getInstanceModel(id: string) {+ const editor = this.getEditor(id);+ const model = editor.getModel() as any;+ if (model == null) {+ return null;+ }++ return {+ id: model.id,+ uri: model.uri.toString()+ };+ }++ public static getInstanceDiffModel(id: string) {+ const editor = this.getEditor(id) as unknown as monaco.editor.IStandaloneDiffEditor;+ const model = editor.getModel();+ if (model == null) {+ return null;+ }++ return {+ original: {+ id: model.original.id,+ uri: model.original.uri.toString()+ },+ modified: {+ id: model.modified.id,+ uri: model.modified.uri.toString()+ }+ };+ }++ public static getLayoutInfo(id: string): monaco.editor.EditorLayoutInfo {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getLayoutInfo();+ }++ public static getOffsetForColumn(id: string, lineNumber: number, column: number): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getOffsetForColumn(lineNumber, column);+ }++ public static getOption(id: string, optionId: monaco.editor.EditorOption): string {+ const editor = this.getStandaloneCodeEditor(id);+ return JSON.stringify(editor.getOption(optionId));+ }++ public static getOptions(id: string) {+ const editor = this.getStandaloneCodeEditor(id);+ return (editor.getOptions() as any)._values.map(function (value) {+ return JSON.stringify(value);+ });+ }++ public static getPosition(id: string): monaco.Position {+ const editor = this.getEditor(id);+ return editor.getPosition();+ }++ public static getRawOptions(id: string): monaco.editor.IEditorOptions {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getRawOptions();+ }++ public static getScrollHeight(id: string): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollHeight();+ }++ public static getScrollLeft(id: string): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollLeft();+ }++ public static getScrollTop(id: string): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollTop();+ }++ public static getScrollWidth(id: string): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrollWidth();+ }++ public static getScrolledVisiblePosition(id: string, position: monaco.IPosition) {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getScrolledVisiblePosition(position);+ }++ public static getSelection(id: string): monaco.Selection {+ const editor = this.getEditor(id);+ return editor.getSelection();+ }++ public static getSelections(id: string): monaco.Selection[] {+ const editor = this.getEditor(id);+ return editor.getSelections();+ }++ public static getTargetAtClientPoint(id: string, clientX: number, clientY: number): monaco.editor.IMouseTarget {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getTargetAtClientPoint(clientX, clientY);+ }++ public static getTopForLineNumber(id: string, lineNumber: number): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getTopForLineNumber(lineNumber);+ }++ public static getTopForPosition(id: string, lineNumber: number, column: number): number {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getTopForPosition(lineNumber, column);+ }++ public static getVisibleColumnFromPosition(id: string, position: monaco.IPosition): number {+ const editor = this.getEditor(id);+ return editor.getVisibleColumnFromPosition(position);+ }++ public static getVisibleRanges(id: string): monaco.Range[] {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.getVisibleRanges();+ }++ public static hasTextFocus(id: string): boolean {+ const editor = this.getEditor(id);+ return editor.hasTextFocus();+ }++ public static hasWidgetFocus(id: string): boolean {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.hasWidgetFocus();+ }++ public static layout(id: string, dimension?: monaco.editor.IDimension): void {+ const editor = this.getEditor(id);+ editor.layout(dimension);+ }++ public static pushUndoStop(id: string): boolean {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.pushUndoStop();+ }++ public static popUndoStop(id: string): boolean {+ const editor = this.getStandaloneCodeEditor(id);+ return editor.popUndoStop();+ }++ public static render(id: string, forceRedraw?: boolean): void {+ const editor = this.getStandaloneCodeEditor(id);+ editor.render(forceRedraw);+ }++ public static revealLine(id: string, lineNumber: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealLine(lineNumber, scrollType);+ }++ public static revealLineInCenter(id: string, lineNumber: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealLineInCenter(lineNumber, scrollType);+ }++ public static revealLineInCenterIfOutsideViewport(id: string, lineNumber: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealLineInCenterIfOutsideViewport(lineNumber, scrollType);+ }++ public static revealLines(id: string, startLineNumber: number, endLineNumber: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealLines(startLineNumber, endLineNumber, scrollType);+ }++ public static revealLinesInCenter(id: string, startLineNumber: number, endLineNumber: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealLinesInCenter(startLineNumber, endLineNumber, scrollType);+ }++ public static revealLinesInCenterIfOutsideViewport(id: string, startLineNumber: number, endLineNumber: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType);+ }++ public static revealPosition(id: string, position: monaco.IPosition, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealPosition(position, scrollType);+ }++ public static revealPositionInCenter(id: string, position: monaco.IPosition, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealPositionInCenter(position, scrollType);+ }++ public static revealPositionInCenterIfOutsideViewport(id: string, position: monaco.IPosition, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealPositionInCenterIfOutsideViewport(position, scrollType);+ }++ public static revealRange(id: string, range: monaco.IRange, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealRange(range, scrollType);+ }++ public static revealRangeAtTop(id: string, range: monaco.IRange, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealRangeAtTop(range, scrollType);+ }++ public static revealRangeInCenter(id: string, range: monaco.IRange, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealRangeInCenter(range, scrollType);+ }++ public static revealRangeInCenterIfOutsideViewport(id: string, range: monaco.IRange, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getEditor(id);+ editor.revealRangeInCenterIfOutsideViewport(range, scrollType);+ }++ public static setEventListener(id: string, eventName: string): void {+ const editorHolder = this.getEditorHolder(id);+ const editor = editorHolder.editor as monaco.editor.IStandaloneCodeEditor;+ const dotNetObjRef = editorHolder.dotNetObjRef;++ const listener = function (e?: unknown) {+ let eventJson = JSON.stringify(e);+ if (eventName == "OnDidChangeModel") {+ const eStrong = e as monaco.editor.IModelChangedEvent;+ eventJson = JSON.stringify({+ oldModelUri: eStrong.oldModelUrl == null ? null : eStrong.oldModelUrl.toString(),+ newModelUri: eStrong.newModelUrl == null ? null : eStrong.newModelUrl.toString(),+ });+ }+ else if (eventName == "OnDidChangeConfiguration") {+ const eStrong = e as monaco.editor.ConfigurationChangedEvent;+ eventJson = JSON.stringify((eStrong as any)._values);+ }+ dotNetObjRef.invokeMethodAsync("EventCallback", eventName, eventJson);+ };++ switch (eventName) {+ case "OnDidCompositionEnd":+ editor.onDidCompositionEnd(listener);+ break;++ case "OnDidCompositionStart":+ editor.onDidCompositionStart(listener);+ break;++ case "OnContextMenu":+ editor.onContextMenu(listener);+ break;++ case "OnDidBlurEditorText":+ editor.onDidBlurEditorText(listener);+ break;++ case "OnDidBlurEditorWidget":+ editor.onDidBlurEditorWidget(listener);+ break;++ case "OnDidChangeConfiguration":+ editor.onDidChangeConfiguration(listener);+ break;++ case "OnDidChangeCursorPosition":+ editor.onDidChangeCursorPosition(listener);+ break;++ case "OnDidChangeCursorSelection":+ editor.onDidChangeCursorSelection(listener);+ break;++ case "OnDidChangeModel":+ editor.onDidChangeModel(listener);+ break;++ case "OnDidChangeModelContent":+ editor.onDidChangeModelContent(listener);+ break;++ case "OnDidChangeModelDecorations":+ editor.onDidChangeModelDecorations(listener);+ break;++ case "OnDidChangeModelLanguage":+ editor.onDidChangeModelLanguage(listener);+ break;++ case "OnDidChangeModelLanguageConfiguration":+ editor.onDidChangeModelLanguageConfiguration(listener);+ break;++ case "OnDidChangeModelOptions":+ editor.onDidChangeModelOptions(listener);+ break;++ case "OnDidContentSizeChange":+ editor.onDidContentSizeChange(listener);+ break;++ case "OnDidDispose":+ editor.onDidDispose(listener);+ break;++ case "OnDidFocusEditorText":+ editor.onDidFocusEditorText(listener);+ break;++ case "OnDidFocusEditorWidget":+ editor.onDidFocusEditorWidget(listener);+ break;++ case "OnDidLayoutChange":+ editor.onDidLayoutChange(listener);+ break;++ case "OnDidPaste":+ editor.onDidPaste(listener);+ break;++ case "OnDidScrollChange":+ editor.onDidScrollChange(listener);+ break;++ case "OnKeyDown":+ editor.onKeyDown(listener);+ break;++ case "OnKeyUp":+ editor.onKeyUp(listener);+ break;++ case "OnMouseDown":+ editor.onMouseDown(listener);+ break;++ case "OnMouseLeave":+ editor.onMouseLeave(listener);+ break;++ case "OnMouseMove":+ editor.onMouseMove(listener);+ break;++ case "OnMouseUp":+ editor.onMouseUp(listener);+ break;+ }+ }++ public static setInstanceModel(id: string, uriStr: string): void {+ const model = MonacoEditor.TextModel.getModel(uriStr);+ if (model == null) {+ return;+ }++ const editor = this.getEditor(id);+ editor.setModel(model);+ }++ public static setInstanceDiffModel(id: string, model: monaco.editor.IDiffEditorModel): void {+ const original_model = MonacoEditor.TextModel.getModel(model.original.uri.toString());+ const modified_model = MonacoEditor.TextModel.getModel(model.modified.uri.toString());+ if (original_model == null || modified_model == null) {+ return;+ }++ const editor = this.getEditor(id) as unknown as monaco.editor.IStandaloneDiffEditor;+ editor.setModel({+ original: original_model,+ modified: modified_model,+ });+ }++ public static setPosition(id: string, position?: monaco.IPosition): void {+ const editor = this.getEditor(id);+ editor.setPosition(position);+ }++ public static setScrollLeft(id: string, newScrollLeft: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getStandaloneCodeEditor(id);+ editor.setScrollLeft(newScrollLeft, scrollType);+ }++ public static setScrollPosition(id: string, newPosition: monaco.editor.INewScrollPosition, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getStandaloneCodeEditor(id);+ editor.setScrollPosition(newPosition, scrollType);+ }++ public static setScrollTop(id: string, newScrollTop: number, scrollType?: monaco.editor.ScrollType): void {+ const editor = this.getStandaloneCodeEditor(id);+ editor.setScrollTop(newScrollTop, scrollType);+ }++ public static setSelection(id: string, selection: monaco.IRange): void {+ const editor = this.getEditor(id);+ editor.setSelection(selection);+ }++ public static setSelections(id: string, selections: monaco.ISelection[]): void {+ const editor = this.getEditor(id);+ editor.setSelections(selections);+ }++ public static trigger(id: string, source: string, handlerId: string, payload: any): void {+ const editor = this.getEditor(id);+ editor.trigger(source, handlerId, payload);+ }++ public static uuidv4() {+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {+ const r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);+ return v.toString(16);+ });+ }++ private static getEditor(id: string, unobstrusive = false): monaco.editor.IEditor | null {+ const editorHolder = MonacoEditor.getEditorHolder(id, unobstrusive);+ return editorHolder == null ? null : editorHolder.editor;+ }++ private static getStandaloneCodeEditor(id: string, unobstrusive = false): monaco.editor.IStandaloneCodeEditor | null {+ const editorHolder = MonacoEditor.getEditorHolder(id, unobstrusive);++ if (editorHolder === null) {+ return null;+ }++ if (editorHolder.isDiffEditor) {+ throw "Code editor was expected but a Diff editor has been found.";+ }++ return editorHolder.editor as monaco.editor.IStandaloneCodeEditor;+ }++ private static getStandaloneDiffEditor(id: string, unobstrusive = false): monaco.editor.IStandaloneDiffEditor | null {+ const editorHolder = MonacoEditor.getEditorHolder(id, unobstrusive);++ if (editorHolder === null) {+ return null;+ }++ if (!editorHolder.isDiffEditor) {+ throw "Diff editor was expected but a Code editor has been found.";+ }++ return editorHolder.editor as monaco.editor.IStandaloneDiffEditor;+ }++ private static getEditorHolder(id: string, unobstrusive = false): MonacoEditorHolder {+ const editorHolder: MonacoEditorHolder = MonacoEditor.editors.find(e => e.id === id);+ if (!editorHolder) {+ if (unobstrusive) {+ console.log("WARNING : Couldn't find the editor with id: " + id + " editors.length: " + MonacoEditor.editors.length);+ return null;+ }+ throw "Couldn't find the editor with id: " + id + " editors.length: " + MonacoEditor.editors.length;+ }+ else if (!editorHolder.editor) {+ if (unobstrusive) {+ console.log("WARNING : editor is null for editorHolder: " + editorHolder);+ return null;+ }+ throw "editor is null for editorHolder: " + editorHolder;+ }+ return editorHolder;+ }++ public static TextModel = class {+ public static getModel(uriStr: string): monaco.editor.ITextModel {+ const uri = monaco.Uri.parse(uriStr);+ if (uri == null) {+ return null;+ }+ return monaco.editor.getModel(uri);+ }++ public static getOptions(uriStr: string): monaco.editor.TextModelResolvedOptions {+ const model = this.getModel(uriStr);+ return model.getOptions();+ }++ public static getVersionId(uriStr: string): number {+ const model = this.getModel(uriStr);+ return model.getVersionId();+ }++ public static getAlternativeVersionId(uriStr: string): number {+ const model = this.getModel(uriStr);+ return model.getAlternativeVersionId();+ }++ public static setValue(uriStr: string, newValue: string): void {+ const model = this.getModel(uriStr);+ model.setValue(newValue);+ }++ public static getValue(uriStr: string, eol?: monaco.editor.EndOfLinePreference, preserveBOM?: boolean): string {+ const model = this.getModel(uriStr);+ return model.getValue(eol, preserveBOM);+ }++ public static getValueLength(uriStr: string, eol?: monaco.editor.EndOfLinePreference, preserveBOM?: boolean): number {+ const model = this.getModel(uriStr);+ return model.getValueLength(eol, preserveBOM);+ }++ public static getValueInRange(uriStr: string, range: monaco.IRange, eol?: monaco.editor.EndOfLinePreference): string {+ const model = this.getModel(uriStr);+ return model.getValueInRange(range, eol);+ }++ public static getValueLengthInRange(uriStr: string, range: monaco.IRange): number {+ const model = this.getModel(uriStr);+ return model.getValueLengthInRange(range);+ }++ public static getCharacterCountInRange(uriStr: string, range: monaco.IRange): number {+ const model = this.getModel(uriStr);+ return model.getCharacterCountInRange(range);+ }++ public static getLineCount(uriStr: string): number {+ const model = this.getModel(uriStr);+ return model.getLineCount();+ }++ public static getLineContent(uriStr: string, lineNumber: number): string {+ const model = this.getModel(uriStr);+ return model.getLineContent(lineNumber);+ }++ public static getLineLength(uriStr: string, lineNumber: number): number {+ const model = this.getModel(uriStr);+ return model.getLineLength(lineNumber);+ }++ public static getLinesContent(uriStr: string): string[] {+ const model = this.getModel(uriStr);+ return model.getLinesContent();+ }++ public static getEOL(uriStr: string): string {+ const model = this.getModel(uriStr);+ return model.getEOL();+ }++ public static getEndOfLineSequence(uriStr: string): monaco.editor.EndOfLineSequence {+ const model = this.getModel(uriStr);+ return model.getEndOfLineSequence();+ }++ public static getLineMinColumn(uriStr: string, lineNumber: number): number {+ const model = this.getModel(uriStr);+ return model.getLineMinColumn(lineNumber);+ }++ public static getLineMaxColumn(uriStr: string, lineNumber: number): number {+ const model = this.getModel(uriStr);+ return model.getLineMaxColumn(lineNumber);+ }++ public static getLineFirstNonWhitespaceColumn(uriStr: string, lineNumber: number): number {+ const model = this.getModel(uriStr);+ return model.getLineFirstNonWhitespaceColumn(lineNumber);+ }++ public static getLineLastNonWhitespaceColumn(uriStr: string, lineNumber: number): number {+ const model = this.getModel(uriStr);+ return model.getLineLastNonWhitespaceColumn(lineNumber);+ }++ public static validatePosition(uriStr: string, position: monaco.IPosition): monaco.Position {+ const model = this.getModel(uriStr);+ return model.validatePosition(position);+ }++ public static modifyPosition(uriStr: string, position: monaco.IPosition, offset: number): monaco.Position {+ const model = this.getModel(uriStr);+ return model.modifyPosition(position, offset);+ }++ public static validateRange(uriStr: string, range: monaco.IRange): monaco.Range {+ const model = this.getModel(uriStr);+ return model.validateRange(range);+ }++ public static getOffsetAt(uriStr: string, position: monaco.IPosition): number {+ const model = this.getModel(uriStr);+ return model.getOffsetAt(position);+ }++ public static getPositionAt(uriStr: string, offset: number): monaco.Position {+ const model = this.getModel(uriStr);+ return model.getPositionAt(offset);+ }++ public static getFullModelRange(uriStr: string): monaco.Range {+ const model = this.getModel(uriStr);+ return model.getFullModelRange();+ }++ public static isDisposed(uriStr: string): boolean {+ const model = this.getModel(uriStr);+ return model.isDisposed();+ }++ public static findMatches(+ uriStr: string,+ searchString: string,+ searchScope_or_searchOnlyEditableRange: boolean,+ isRegex: boolean,+ matchCase: boolean,+ wordSeparators: string,+ captureMatches: boolean,+ limitResultCount?: number): monaco.editor.FindMatch[] {++ const model = this.getModel(uriStr);+ return model.findMatches(+ searchString,+ searchScope_or_searchOnlyEditableRange,+ isRegex,+ matchCase,+ wordSeparators,+ captureMatches,+ limitResultCount);+ }++ public static findNextMatch(+ uriStr: string,+ searchString: string,+ searchStart: monaco.IPosition,+ isRegex: boolean,+ matchCase: boolean,+ wordSeparators: string,+ captureMatches: boolean): monaco.editor.FindMatch {++ const model = this.getModel(uriStr);+ return model.findNextMatch(+ searchString,+ searchStart,+ isRegex,+ matchCase,+ wordSeparators,+ captureMatches);+ }++ public static findPreviousMatch(+ uriStr: string,+ searchString: string,+ searchStart: monaco.IPosition,+ isRegex: boolean,+ matchCase: boolean,+ wordSeparators: string,+ captureMatches: boolean): monaco.editor.FindMatch {++ const model = this.getModel(uriStr);+ return model.findPreviousMatch(+ searchString,+ searchStart,+ isRegex,+ matchCase,+ wordSeparators,+ captureMatches);+ }++ public static getLanguageId(uriStr: string): string {+ const model = this.getModel(uriStr);+ return model.getLanguageId();+ }++ public static getWordAtPosition(uriStr: string, position: monaco.IPosition): monaco.editor.IWordAtPosition {+ const model = this.getModel(uriStr);+ return model.getWordAtPosition(position);+ }++ public static getWordUntilPosition(uriStr: string, position: monaco.IPosition): monaco.editor.IWordAtPosition {+ const model = this.getModel(uriStr);+ return model.getWordUntilPosition(position);+ }++ public static deltaDecorations(uriStr: string, oldDecorations: string[], newDecorations: monaco.editor.IModelDecoration[], ownerId?: number): string[] {+ const model = this.getModel(uriStr);+ return model.deltaDecorations(oldDecorations, newDecorations, ownerId);+ }++ public static getDecorationOptions(uriStr: string, id: string): monaco.editor.IModelDecorationOptions {+ const model = this.getModel(uriStr);+ return model.getDecorationOptions(id);+ }++ public static getDecorationRange(uriStr: string, id: string): monaco.Range {+ const model = this.getModel(uriStr);+ return model.getDecorationRange(id);+ }++ public static getLineDecorations(uriStr: string, lineNumber: number, ownerId?: number, filterOutValidation?: boolean): monaco.editor.IModelDecoration[] {+ const model = this.getModel(uriStr);+ return model.getLineDecorations(lineNumber, ownerId, filterOutValidation);+ }++ public static getLinesDecorations(uriStr: string, startLineNumber: number, endLineNumber: number, ownerId?: number, filterOutValidation?: boolean): monaco.editor.IModelDecoration[] {+ const model = this.getModel(uriStr);+ return model.getLinesDecorations(startLineNumber, endLineNumber, ownerId, filterOutValidation);+ }++ public static getDecorationsInRange(uriStr: string, range: monaco.IRange, ownerId?: number, filterOutValidation?: boolean): monaco.editor.IModelDecoration[] {+ const model = this.getModel(uriStr);+ return model.getDecorationsInRange(range, ownerId, filterOutValidation);+ }++ public static getAllDecorations(uriStr: string, ownerId?: number, filterOutValidation?: boolean): monaco.editor.IModelDecoration[] {+ const model = this.getModel(uriStr);+ return model.getAllDecorations(ownerId, filterOutValidation);+ }++ public static getInjectedTextDecorations(uriStr: string, ownerId?: number): monaco.editor.IModelDecoration[] {+ const model = this.getModel(uriStr);+ return model.getInjectedTextDecorations(ownerId);+ }++ public static getOverviewRulerDecorations(uriStr: string, ownerId?: number, filterOutValidation?: boolean): monaco.editor.IModelDecoration[] {+ const model = this.getModel(uriStr);+ return model.getOverviewRulerDecorations(ownerId, filterOutValidation);+ }++ public static normalizeIndentation(uriStr: string, str: string): string {+ const model = this.getModel(uriStr);+ return model.normalizeIndentation(str);+ }++ public static updateOptions(uriStr: string, newOpts: monaco.editor.ITextModelUpdateOptions): void {+ const model = this.getModel(uriStr);+ return model.updateOptions(newOpts);+ }++ public static detectIndentation(uriStr: string, defaultInsertSpaces: boolean, defaultTabSize: number): void {+ const model = this.getModel(uriStr);+ model.detectIndentation(defaultInsertSpaces, defaultTabSize);+ }++ public static pushStackElement(uriStr: string): void {+ const model = this.getModel(uriStr);+ model.pushStackElement();+ }++ public static popStackElement(uriStr: string): void {+ const model = this.getModel(uriStr);+ model.popStackElement();+ }++ public static pushEOL(uriStr: string, eol: monaco.editor.EndOfLineSequence): void {+ const model = this.getModel(uriStr);+ model.pushEOL(eol);+ }++ public static applyEdits(uriStr: string, operations: monaco.editor.IIdentifiedSingleEditOperation[], computeUndoEdits: false): void {+ const model = this.getModel(uriStr);+ model.applyEdits(operations, computeUndoEdits);+ }++ public static setEOL(uriStr: string, eol: monaco.editor.EndOfLineSequence): void {+ const model = this.getModel(uriStr);+ model.setEOL(eol);+ }++ public static dispose(uriStr: string): void {+ const model = this.getModel(uriStr);+ model.dispose();+ }+ };+}++export default MonacoEditor;\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor b/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razordeleted file mode 100644index 10413e4b7..000000000--- a/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor+++ /dev/null@@ -1,6 +0,0 @@-@inherits JSStyledComponentBase--<div style="display: flex; align-items: center; justify-content: center;">- @* <FluentProgressRing id="@($"{Id}-loading")" Style="position: fixed;" />*@- <div id="@Id" style="@StyleValue" class="@ClassValue"></div>-</div>\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor.csdeleted file mode 100644index a59a6821f..000000000--- a/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor.cs+++ /dev/null@@ -1,140 +0,0 @@-namespace DevToys.Blazor.Components;--public partial class MonacoEditor : JSStyledComponentBase-{- private const string JAVASCRIPT_FILE = "./_content/DevToys.Blazor/Components/MonacoEditor.razor.js";- private const string MONACO_VS_PATH = "./_content/DevToys.Blazor/lib/monaco-editor/min/vs";-- private string _value = """- using System;- void Main()- {- Console.WriteLine("Hello World");- }- """;-- protected string? ClassValue => new CssBuilder(FinalCssClasses).Build();-- protected string? StyleValue => new StyleBuilder()- .AddStyle("height", Height, () => !string.IsNullOrEmpty(Height))- .AddStyle("width", Width, () => !string.IsNullOrEmpty(Width))- .AddStyle("border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest)")- .AddStyle(Style)- .Build();-- [Inject]- private IJSRuntime JSRuntime { get; set; } = default!;-- private IJSObjectReference JSModule { get; set; } = default!;-- /// <summary>- /// Language used by the editor: csharp, javascript, ...- /// </summary>- [Parameter]- public string Language { get; set; } = "csharp";-- /// <summary>- /// Height of this component.- /// </summary>- [Parameter]- public string Height { get; set; } = "300px";-- /// <summary>- /// Width of this component.- /// </summary>- [Parameter]- public string Width { get; set; } = "100%";-- /// <summary>- /// Theme of the editor (Light or Dark).- /// </summary>- [Parameter]- public bool IsDarkMode { get; set; } = false;-- /// <summary>- /// Gets or sets the value of the input. This should be used with two-way binding.- /// </summary>- [Parameter]- public string Value- {- get- {- return _value;- }-- set- {- _value = value;- }- }-- /// <summary>- /// Gets or sets a callback that updates the bound value.- /// </summary>- [Parameter]- public EventCallback<string> OnValueChanged { get; set; }-- /// <summary />- protected override async Task OnParametersSetAsync()- {- if (JSModule != null)- {- await JSModule.InvokeVoidAsync(- "monacoSetOptions",- Id,- new { Value = this.Value, Theme = GetTheme(IsDarkMode), Language = this.Language, });- }- }-- /// <summary />- protected override async Task OnAfterRenderAsync(bool firstRender)- {- await base.OnAfterRenderAsync(firstRender);-- if (firstRender)- {- JSModule = await JSRuntime.InvokeAsync<IJSObjectReference>("import", JAVASCRIPT_FILE);-- var options = new- {- Value = Value,- Language = Language,- Theme = GetTheme(IsDarkMode),- Path = MONACO_VS_PATH,- LineNumbers = true,- ReadOnly = false,- };- await JSModule.InvokeVoidAsync("monacoInitialize", Id, Reference, options);- }-- await base.OnAfterRenderAsync(firstRender);- }-- /// <summary />- private string GetTheme(bool isDarkMode)- {- return isDarkMode ? "vs-dark" : "vs";- }-- /// <summary />- [JSInvokable]- public async Task UpdateValueAsync(string value)- {- _value = value;- if (OnValueChanged.HasDelegate)- {- await OnValueChanged.InvokeAsync(_value);- }- }-- /// <summary />- public override async ValueTask DisposeAsync()- {- if (JSModule is not null)- {- await JSModule.DisposeAsync();- }-- await base.DisposeAsync();- }-}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor.js b/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor.jsdeleted file mode 100644index 049908997..000000000--- a/src/app/dev/DevToys.Blazor/Components/MonacoEditor.razor.js+++ /dev/null@@ -1,52 +0,0 @@-// Initialize Monaco Editor-export function monacoInitialize(id, dotNetHelper, options) {- // require is provided by loader.min.js.- require.config({- paths: { 'vs': options.path }- });-- require(["vs/editor/editor.main"], () => {- var container = document.getElementById(id);-- // Hide the Progress Ring- monaco.editor.onDidCreateEditor((e) => {- var progress = document.getElementById(id + "-loading");- if (progress && progress.style) {- progress.style.display = "none";- }- });-- // Create the Monaco Editor- container.editor = monaco.editor.create(container, {- ariaLabel: "online code editor",- value: options.value,- language: options.language,- theme: options.theme,- lineNumbers: options.lineNumbers ? "on" : "off",- readOnly: options.readOnly,- });-- // Keep a reference of dotNetHelper- container.dotNetHelper = dotNetHelper;-- // Catch when the editor lost the focus (didType to immediate)- container.editor.onDidBlurEditorText((e) => {- var code = container.editor.getValue();- container.dotNetHelper.invokeMethodAsync("UpdateValueAsync", code);- });-- container.editor.updateOptions(options);-- window.editor = container.editor; // To debug- });-}--// Update the editor options-export function monacoSetOptions(id, options) {- var container = document.getElementById(id);- container.editor.setValue(options.value);- container.editor.updateOptions({- language: options.language,- theme: options.theme- });-}\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/AccessibilitySupport.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/AccessibilitySupport.csnew file mode 100644index 000000000..5beee5593--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/AccessibilitySupport.cs@@ -0,0 +1,17 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum AccessibilitySupport+{+ /// <summary>+ /// This should be the browser case where it is not known if a screen reader is attached or no.+ /// </summary>+ Unknown = 0,++ Disabled = 1,++ Enabled = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ActionDescriptor.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ActionDescriptor.csnew file mode 100644index 000000000..1f4263699--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ActionDescriptor.cs@@ -0,0 +1,61 @@+using System.Text.Json.Serialization;++///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Description of an action contribution+/// </summary>+public class ActionDescriptor+{+ /// <summary>+ /// An unique identifier of the contributed action.+ /// </summary>+ public string? Id { get; set; }++ /// <summary>+ /// A label of the action that will be presented to the user.+ /// </summary>+ public string? Label { get; set; }++ /// <summary>+ /// Precondition rule.+ /// </summary>+ public string? Precondition { get; set; }++ /// <summary>+ /// An array of keybindings for the action.+ /// </summary>+ public int[]? Keybindings { get; set; }++ /// <summary>+ /// The keybinding rule (condition on top of precondition).+ /// </summary>+ public string? KeybindingContext { get; set; }++ /// <summary>+ /// Control if the action should show up in the context menu and where.+ /// The context menu of the editor has these default:+ /// navigation - The navigation group comes first in all cases.+ /// 1_modification - This group comes next and contains commands that modify your code.+ /// 9_cutcopypaste - The last default group with the basic editing commands.+ /// You can also create your own group.+ /// Defaults to null (don't show in context menu).+ /// </summary>+ public string? ContextMenuGroupId { get; set; }++ /// <summary>+ /// Control the order in the context menu group.+ /// </summary>+ public float ContextMenuOrder { get; set; }++ /// <summary>+ /// Method that will be executed when the action is triggered.+ /// @param editor The editor instance is passed in as a convenience+ /// </summary>+ [JsonIgnore]+ public Action<RicherMonacoEditorBase>? Run { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ApplyUpdateResult.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ApplyUpdateResult.csnew file mode 100644index 000000000..fb763dd3a--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ApplyUpdateResult.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ApplyUpdateResult<T>+{+ public T NewValue { get; }++ public bool DidChange { get; }++ public ApplyUpdateResult(T newValue, bool didChange)+ {+ NewValue = newValue;+ DidChange = didChange;+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BaseMouseTarget.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BaseMouseTarget.csnew file mode 100644index 000000000..732d8639c--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BaseMouseTarget.cs@@ -0,0 +1,37 @@+using System.Text.Json;++///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class BaseMouseTarget+{+ /// <summary>+ /// The target element+ /// </summary>+ public JsonElement? Element { get; set; }++ /// <summary>+ /// The 'approximate' editor position+ /// </summary>+ public Position? Position { get; set; }++ /// <summary>+ /// Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).+ /// </summary>+ public int MouseColumn { get; set; }++ /// <summary>+ /// The 'approximate' editor range+ /// </summary>+ public Range? Range { get; set; }++ public MouseTargetType Type { get; set; }++ /// <summary>+ /// The 'approximate' editor range+ /// </summary>+ public object? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BracketPairColorizationOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BracketPairColorizationOptions.csnew file mode 100644index 000000000..261603ddb--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BracketPairColorizationOptions.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class BracketPairColorizationOptions+{+ /// <summary>+ /// Enable or disable bracket pair colorization.+ /// </summary>+ public bool? Enabled { get; set; }++ /// <summary>+ /// Use independent color pool per bracket type.+ /// </summary>+ public bool? IndependentColorPoolPerBracketType { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BuiltinTheme.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BuiltinTheme.csnew file mode 100644index 000000000..a035bbddc--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/BuiltinTheme.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class BuiltinTheme+{+ public const string Vs = "vs";++ public const string VsDark = "vs-dark";++ public const string HcBlack = "hc-black";++ public const string HcLight = "hc-light";+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ColorizerElementOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ColorizerElementOptions.csnew file mode 100644index 000000000..0e4483be3--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ColorizerElementOptions.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ColorizerElementOptions : ColorizerOptions+{+ public string? Theme { get; set; }++ public string? MimeType { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ColorizerOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ColorizerOptions.csnew file mode 100644index 000000000..b1da4ac20--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ColorizerOptions.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ColorizerOptions+{+ public int? TabSize { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ComputedEditorOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ComputedEditorOptions.csnew file mode 100644index 000000000..63a78c637--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ComputedEditorOptions.cs@@ -0,0 +1,25 @@+using System.Text.Json;++///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// All computed editor options.+/// </summary>+public class ComputedEditorOptions+{+ private readonly List<string> _options;++ public ComputedEditorOptions(List<string> options)+ {+ _options = options;+ }++ public T? Get<T>(EditorOption id)+ {+ return JsonSerializer.Deserialize<T>(_options[(int)id]);+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ConfigurationChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ConfigurationChangedEvent.csnew file mode 100644index 000000000..c7abde017--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ConfigurationChangedEvent.cs@@ -0,0 +1,23 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that the configuration of the editor has changed.+/// </summary>+public class ConfigurationChangedEvent+{+ private readonly List<bool>? _options;++ public ConfigurationChangedEvent(List<bool>? options)+ {+ _options = options;+ }++ public bool HasChanged(EditorOption id)+ {+ return _options is not null && _options[(int)id];+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ContentSizeChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ContentSizeChangedEvent.csnew file mode 100644index 000000000..7ae7dda32--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ContentSizeChangedEvent.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ContentSizeChangedEvent+{+ public double ContentWidth { get; set; }++ public double ContentHeight { get; set; }++ public bool ContentWidthChanged { get; set; }++ public bool ContentHeightChanged { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ContentWidgetPositionPreference.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ContentWidgetPositionPreference.csnew file mode 100644index 000000000..6b2748f9d--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ContentWidgetPositionPreference.cs@@ -0,0 +1,26 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A positioning preference for rendering content widgets.+/// </summary>+public enum ContentWidgetPositionPreference+{+ /// <summary>+ /// Place the content widget exactly at a position+ /// </summary>+ EXACT = 0,++ /// <summary>+ /// Place the content widget above a position+ /// </summary>+ ABOVE = 1,++ /// <summary>+ /// Place the content widget below a position+ /// </summary>+ BELOW = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorChangeReason.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorChangeReason.csnew file mode 100644index 000000000..e4f34d594--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorChangeReason.cs@@ -0,0 +1,46 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Describes the reason the cursor has changed its position.+/// </summary>+public enum CursorChangeReason+{+ /// <summary>+ /// Unknown or not set.+ /// </summary>+ NotSet = 0,++ /// <summary>+ /// A `model.setValue()` was called.+ /// </summary>+ ContentFlush = 1,++ /// <summary>+ /// The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.+ /// </summary>+ RecoverFromMarkers = 2,++ /// <summary>+ /// There was an explicit user gesture.+ /// </summary>+ Explicit = 3,++ /// <summary>+ /// There was a Paste.+ /// </summary>+ Paste = 4,++ /// <summary>+ /// There was an Undo.+ /// </summary>+ Undo = 5,++ /// <summary>+ /// There was a Redo.+ /// </summary>+ Redo = 6+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorPositionChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorPositionChangedEvent.csnew file mode 100644index 000000000..c59d4147b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorPositionChangedEvent.cs@@ -0,0 +1,31 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that the cursor position has changed.+/// </summary>+public class CursorPositionChangedEvent+{+ /// <summary>+ /// Primary cursor's position.+ /// </summary>+ public Position? Position { get; set; }++ /// <summary>+ /// Secondary cursors' position.+ /// </summary>+ public List<Position>? SecondaryPositions { get; set; }++ /// <summary>+ /// Reason.+ /// </summary>+ public CursorChangeReason Reason { get; set; }++ /// <summary>+ /// Source of the call that caused the event.+ /// </summary>+ public string? Source { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorSelectionChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorSelectionChangedEvent.csnew file mode 100644index 000000000..552cadcf3--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/CursorSelectionChangedEvent.cs@@ -0,0 +1,46 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that the cursor selection has changed.+/// </summary>+public class CursorSelectionChangedEvent+{+ /// <summary>+ /// The primary selection.+ /// </summary>+ public Selection? Selection { get; set; }++ /// <summary>+ /// The secondary selections.+ /// </summary>+ public List<Selection>? SecondarySelections { get; set; }++ /// <summary>+ /// The model version id.+ /// </summary>+ public int ModelVersionId { get; set; }++ /// <summary>+ /// The old selections.+ /// </summary>+ public List<Selection>? OldSelections { get; set; }++ /// <summary>+ /// The model version id the that `oldSelections` refer to.+ /// </summary>+ public int OldModelVersionId { get; set; }++ /// <summary>+ /// Source of the call that caused the event.+ /// </summary>+ public string? Source { get; set; }++ /// <summary>+ /// Reason.+ /// </summary>+ public CursorChangeReason Reason { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DecorationOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DecorationOptions.csnew file mode 100644index 000000000..12b8c5726--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DecorationOptions.cs@@ -0,0 +1,20 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class DecorationOptions+{+ /// <summary>+ /// CSS color to render.+ /// e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry+ /// </summary>+ public string? Color { get; set; }++ /// <summary>+ /// CSS color to render.+ /// e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry+ /// </summary>+ public string? DarkColor { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DefaultEndOfLine.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DefaultEndOfLine.csnew file mode 100644index 000000000..9337ac447--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DefaultEndOfLine.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The default end of line to use when instantiating models.+/// </summary>+public enum DefaultEndOfLine+{+ /// <summary>+ /// Use line feed (\n) as the end of line character.+ /// </summary>+ LF = 1,++ /// <summary>+ /// Use carriage return and line feed (\r\n) as the end of line character.+ /// </summary>+ CRLF = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/Delegates.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/Delegates.csnew file mode 100644index 000000000..4db51d741--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/Delegates.cs@@ -0,0 +1,13 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;+++public delegate void CommandHandler(params object[] args);++/// <summary>+/// A callback that can compute the cursor state after applying a series of edit operations.+/// </summary>+public delegate List<Selection> CursorStateComputer(List<ValidEditOperation> inverseEditOperations);diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorConstructionOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorConstructionOptions.csnew file mode 100644index 000000000..712293a85--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorConstructionOptions.cs@@ -0,0 +1,29 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class DiffEditorConstructionOptions : DiffEditorOptions+{+ /// <summary>+ /// The initial editor dimension (to avoid measuring the container).+ /// </summary>+ public Dimension? Dimension { get; set; }++ /// <summary>+ /// Aria label for original editor.+ /// </summary>+ public string? OriginalAriaLabel { get; set; }++ /// <summary>+ /// Aria label for modified editor.+ /// </summary>+ public string? ModifiedAriaLabel { get; set; }++ /// <summary>+ /// Is the diff editor inside another editor+ /// Defaults to false+ /// </summary>+ public bool? IsInEmbeddedEditor { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorModel.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorModel.csnew file mode 100644index 000000000..2f8b69a29--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorModel.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A model for the diff editor.+/// </summary>+public class DiffEditorModel+{+ /// <summary>+ /// Original model.+ /// </summary>+ public TextModel? Original { get; set; }++ /// <summary>+ /// Modified model.+ /// </summary>+ public TextModel? Modified { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorOptions.csnew file mode 100644index 000000000..efd16c2ad--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffEditorOptions.cs@@ -0,0 +1,33 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for the diff editor.+/// </summary>+public class DiffEditorOptions : EditorOptions, IDiffEditorBaseOptions+{+ public bool? EnableSplitViewResizing { get; set; }++ public bool? RenderSideBySide { get; set; }++ public int? MaxComputationTime { get; set; }++ public int? MaxFileSize { get; set; }++ public bool? IgnoreTrimWhitespace { get; set; }++ public bool? RenderIndicators { get; set; }++ public bool? OriginalEditable { get; set; }++ public bool? DiffCodeLens { get; set; }++ public bool? RenderOverviewRuler { get; set; }++ public string? DiffWordWrap { get; set; }++ public bool? RenderMarginRevertIcon { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffLineInformation.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffLineInformation.csnew file mode 100644index 000000000..5d961293b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffLineInformation.cs@@ -0,0 +1,13 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Information about a line in the diff editor+/// </summary>+public class DiffLineInformation+{+ public int EquivalentLineNumber { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffNavigatorOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffNavigatorOptions.csnew file mode 100644index 000000000..b3c6508b9--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DiffNavigatorOptions.cs@@ -0,0 +1,14 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class DiffNavigatorOptions+{+ public bool? FollowsCaret { get; set; }++ public bool? IgnoreCharChanges { get; set; }++ public bool? AlwaysRevealFirst { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/Dimension.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/Dimension.csnew file mode 100644index 000000000..a2bb542c9--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/Dimension.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class Dimension+{+ public int Width { get; set; }++ public int Height { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DropIntoEditorOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DropIntoEditorOptions.csnew file mode 100644index 000000000..b7eeb808b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/DropIntoEditorOptions.cs@@ -0,0 +1,17 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor drop into behavior+/// </summary>+public class DropIntoEditorOptions+{+ /// <summary>+ /// Enable the dropping into editor.+ /// Defaults to true.+ /// </summary>+ public bool? Enabled { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorAutoIndentStrategy.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorAutoIndentStrategy.csnew file mode 100644index 000000000..76cb818e7--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorAutoIndentStrategy.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for auto indentation in the editor+/// </summary>+public enum EditorAutoIndentStrategy+{+ None = 0,++ Keep = 1,++ Brackets = 2,++ Advanced = 3,++ Full = 4+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorCommentsOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorCommentsOptions.csnew file mode 100644index 000000000..bc6dfa964--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorCommentsOptions.cs@@ -0,0 +1,25 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// </summary>++/// <summary>+/// Configuration options for editor comments+/// </summary>+public class EditorCommentsOptions+{+ /// <summary>+ /// Insert a space after the line comment token and inside the block comments tokens.+ /// Defaults to true.+ /// </summary>+ public bool? InsertSpace { get; set; }++ /// <summary>+ /// Ignore empty lines when inserting line comments.+ /// Defaults to true.+ /// </summary>+ public bool? IgnoreEmptyLines { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorConstructionOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorConstructionOptions.csnew file mode 100644index 000000000..3fde240f8--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorConstructionOptions.cs@@ -0,0 +1,13 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class EditorConstructionOptions : EditorOptions+{+ /// <summary>+ /// The initial editor dimension (to avoid measuring the container).+ /// </summary>+ public Dimension? Dimension { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorExperimentalOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorExperimentalOptions.csnew file mode 100644index 000000000..b2ea287fa--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorExperimentalOptions.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class EditorExperimentalOptions+{+ public StickyScrollOptions? StickyScroll { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorFindOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorFindOptions.csnew file mode 100644index 000000000..c19dbec93--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorFindOptions.cs@@ -0,0 +1,33 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor find widget+/// </summary>+public class EditorFindOptions+{+ /// <summary>+ /// Controls whether the cursor should move to find matches while typing.+ /// </summary>+ public bool? CursorMoveOnType { get; set; }++ /// <summary>+ /// Controls if we seed search string in the Find Widget with editor selection.+ /// </summary>+ public string? SeedSearchStringFromSelection { get; set; }++ /// <summary>+ /// Controls if Find in Selection flag is turned on in the editor.+ /// </summary>+ public bool? AutoFindInSelection { get; set; }++ public bool? AddExtraSpaceOnTop { get; set; }++ /// <summary>+ /// Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found+ /// </summary>+ public bool? Loop { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorHoverOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorHoverOptions.csnew file mode 100644index 000000000..55a3cd589--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorHoverOptions.cs@@ -0,0 +1,35 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor hover+/// </summary>+public class EditorHoverOptions+{+ /// <summary>+ /// Enable the hover.+ /// Defaults to true.+ /// </summary>+ public bool? Enabled { get; set; }++ /// <summary>+ /// Delay for showing the hover.+ /// Defaults to 300.+ /// </summary>+ public int? Delay { get; set; }++ /// <summary>+ /// Is the hover sticky such that it can be clicked and its contents selected?+ /// Defaults to true.+ /// </summary>+ public bool? Sticky { get; set; }++ /// <summary>+ /// Should the hover be shown above the line if possible?+ /// Defaults to false.+ /// </summary>+ public bool? Above { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorInlayHintsOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorInlayHintsOptions.csnew file mode 100644index 000000000..d395496cc--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorInlayHintsOptions.cs@@ -0,0 +1,35 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor inlayHints+/// </summary>+public class EditorInlayHintsOptions+{+ /// <summary>+ /// Enable the inline hints.+ /// Defaults to true.+ /// </summary>+ public string? Enabled { get; set; }++ /// <summary>+ /// Font size of inline hints.+ /// Default to 90% of the editor font size.+ /// </summary>+ public float? FontSize { get; set; }++ /// <summary>+ /// Font family of inline hints.+ /// Defaults to editor font family.+ /// </summary>+ public string? FontFamily { get; set; }++ /// <summary>+ /// Enables the padding around the inlay hint.+ /// Defaults to false.+ /// </summary>+ public bool? Padding { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorLayoutInfo.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorLayoutInfo.csnew file mode 100644index 000000000..e2402a1f8--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorLayoutInfo.cs@@ -0,0 +1,93 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The public layout details of the editor.+/// </summary>+public class EditorLayoutInfo+{+ /// <summary>+ /// Full editor width.+ /// </summary>+ public float Width { get; set; }++ /// <summary>+ /// Full editor height.+ /// </summary>+ public float Height { get; set; }++ /// <summary>+ /// Left position for the glyph margin.+ /// </summary>+ public float GlyphMarginLeft { get; set; }++ /// <summary>+ /// The width of the glyph margin.+ /// </summary>+ public float GlyphMarginWidth { get; set; }++ /// <summary>+ /// Left position for the line numbers.+ /// </summary>+ public float LineNumbersLeft { get; set; }++ /// <summary>+ /// The width of the line numbers.+ /// </summary>+ public float LineNumbersWidth { get; set; }++ /// <summary>+ /// Left position for the line decorations.+ /// </summary>+ public float DecorationsLeft { get; set; }++ /// <summary>+ /// The width of the line decorations.+ /// </summary>+ public float DecorationsWidth { get; set; }++ /// <summary>+ /// Left position for the content (actual text)+ /// </summary>+ public float ContentLeft { get; set; }++ /// <summary>+ /// The width of the content (actual text)+ /// </summary>+ public float ContentWidth { get; set; }++ /// <summary>+ /// Layout information for the minimap+ /// </summary>+ public EditorMinimapLayoutInfo? Minimap { get; set; }++ /// <summary>+ /// The number of columns (of typical characters) fitting on a viewport line.+ /// </summary>+ public float ViewportColumn { get; set; }++ public bool IsWordWrapMinified { get; set; }++ public bool IsViewportWrapping { get; set; }++ public float WrappingColumn { get; set; }++ /// <summary>+ /// The width of the vertical scrollbar.+ /// </summary>+ public float VerticalScrollbarWidth { get; set; }++ /// <summary>+ /// The height of the horizontal scrollbar.+ /// </summary>+ public float HorizontalScrollbarHeight { get; set; }++ /// <summary>+ /// The position of the overview ruler.+ /// </summary>+ public OverviewRulerPosition? OverviewRuler { get; set; }++}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorLightbulbOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorLightbulbOptions.csnew file mode 100644index 000000000..c275b3309--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorLightbulbOptions.cs@@ -0,0 +1,13 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor lightbulb+/// </summary>+public class EditorLightbulbOptions+{+ public bool? Enabled { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMinimapLayoutInfo.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMinimapLayoutInfo.csnew file mode 100644index 000000000..2b4898626--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMinimapLayoutInfo.cs@@ -0,0 +1,33 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The public layout details of the editor.+/// </summary>+public class EditorMinimapLayoutInfo+{+ public RenderMinimap RenderMinimap { get; set; }++ public float MinimapLeft { get; set; }++ public float MinimapWidth { get; set; }++ public bool MinimapHeightIsEditorHeight { get; set; }++ public bool MinimapIsSampling { get; set; }++ public float MinimapScale { get; set; }++ public float MinimapLineHeight { get; set; }++ public float MinimapCanvasInnerWidth { get; set; }++ public float MinimapCanvasInnerHeight { get; set; }++ public float MinimapCanvasOuterWidth { get; set; }++ public float MinimapCanvasOuterHeight { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMinimapOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMinimapOptions.csnew file mode 100644index 000000000..562dd6d71--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMinimapOptions.cs@@ -0,0 +1,57 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor minimap+/// </summary>+public class EditorMinimapOptions+{+ /// <summary>+ /// Enable the rendering of the minimap.+ /// Defaults to true.+ /// </summary>+ public bool? Enabled { get; set; }++ /// <summary>+ /// Control the rendering of minimap.+ /// </summary>+ public bool? Autohide { get; set; }++ /// <summary>+ /// Control the side of the minimap in editor.+ /// Defaults to 'right'.+ /// </summary>+ public string? Side { get; set; }++ /// <summary>+ /// Control the minimap rendering mode.+ /// Defaults to 'actual'.+ /// </summary>+ public string? Size { get; set; }++ /// <summary>+ /// Control the rendering of the minimap slider.+ /// Defaults to 'mouseover'.+ /// </summary>+ public string? ShowSlider { get; set; }++ /// <summary>+ /// Render the actual text on a line (as opposed to color blocks).+ /// Defaults to true.+ /// </summary>+ public bool? RenderCharacters { get; set; }++ /// <summary>+ /// Limit the width of the minimap to render at most a certain number of columns.+ /// Defaults to 120.+ /// </summary>+ public int? MaxColumn { get; set; }++ /// <summary>+ /// Relative size of the font in the minimap. Defaults to 1.+ /// </summary>+ public float? Scale { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMouseEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMouseEvent.csnew file mode 100644index 000000000..5c4b134a7--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorMouseEvent.cs@@ -0,0 +1,15 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A mouse event originating from the editor.+/// </summary>+public class EditorMouseEvent+{+ public MouseEvent? Event { get; set; }++ public BaseMouseTarget? Target { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOption.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOption.csnew file mode 100644index 000000000..59f62bcd4--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOption.cs@@ -0,0 +1,144 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum EditorOption+{+ acceptSuggestionOnCommitCharacter = 0,+ acceptSuggestionOnEnter = 1,+ accessibilitySupport = 2,+ accessibilityPageSize = 3,+ ariaLabel = 4,+ autoClosingBrackets = 5,+ autoClosingDelete = 6,+ autoClosingOvertype = 7,+ autoClosingQuotes = 8,+ autoIndent = 9,+ automaticLayout = 10,+ autoSurround = 11,+ bracketPairColorization = 12,+ guides = 13,+ codeLens = 14,+ codeLensFontFamily = 15,+ codeLensFontSize = 16,+ colorDecorators = 17,+ columnSelection = 18,+ comments = 19,+ contextmenu = 20,+ copyWithSyntaxHighlighting = 21,+ cursorBlinking = 22,+ cursorSmoothCaretAnimation = 23,+ cursorStyle = 24,+ cursorSurroundingLines = 25,+ cursorSurroundingLinesStyle = 26,+ cursorWidth = 27,+ disableLayerHinting = 28,+ disableMonospaceOptimizations = 29,+ domReadOnly = 30,+ dragAndDrop = 31,+ dropIntoEditor = 32,+ emptySelectionClipboard = 33,+ experimental = 34,+ extraEditorClassName = 35,+ fastScrollSensitivity = 36,+ find = 37,+ fixedOverflowWidgets = 38,+ folding = 39,+ foldingStrategy = 40,+ foldingHighlight = 41,+ foldingImportsByDefault = 42,+ foldingMaximumRegions = 43,+ unfoldOnClickAfterEndOfLine = 44,+ fontFamily = 45,+ fontInfo = 46,+ fontLigatures = 47,+ fontSize = 48,+ fontWeight = 49,+ formatOnPaste = 50,+ formatOnType = 51,+ glyphMargin = 52,+ gotoLocation = 53,+ hideCursorInOverviewRuler = 54,+ hover = 55,+ inDiffEditor = 56,+ inlineSuggest = 57,+ letterSpacing = 58,+ lightbulb = 59,+ lineDecorationsWidth = 60,+ lineHeight = 61,+ lineNumbers = 62,+ lineNumbersMinChars = 63,+ linkedEditing = 64,+ links = 65,+ matchBrackets = 66,+ minimap = 67,+ mouseStyle = 68,+ mouseWheelScrollSensitivity = 69,+ mouseWheelZoom = 70,+ multiCursorMergeOverlapping = 71,+ multiCursorModifier = 72,+ multiCursorPaste = 73,+ occurrencesHighlight = 74,+ overviewRulerBorder = 75,+ overviewRulerLanes = 76,+ padding = 77,+ parameterHints = 78,+ peekWidgetDefaultFocus = 79,+ definitionLinkOpensInPeek = 80,+ quickSuggestions = 81,+ quickSuggestionsDelay = 82,+ readOnly = 83,+ renameOnType = 84,+ renderControlCharacters = 85,+ renderFinalNewline = 86,+ renderLineHighlight = 87,+ renderLineHighlightOnlyWhenFocus = 88,+ renderValidationDecorations = 89,+ renderWhitespace = 90,+ revealHorizontalRightPadding = 91,+ roundedSelection = 92,+ rulers = 93,+ scrollbar = 94,+ scrollBeyondLastColumn = 95,+ scrollBeyondLastLine = 96,+ scrollPredominantAxis = 97,+ selectionClipboard = 98,+ selectionHighlight = 99,+ selectOnLineNumbers = 100,+ showFoldingControls = 101,+ showUnused = 102,+ snippetSuggestions = 103,+ smartSelect = 104,+ smoothScrolling = 105,+ stickyTabStops = 106,+ stopRenderingLineAfter = 107,+ suggest = 108,+ suggestFontSize = 109,+ suggestLineHeight = 110,+ suggestOnTriggerCharacters = 111,+ suggestSelection = 112,+ tabCompletion = 113,+ tabIndex = 114,+ unicodeHighlighting = 115,+ unusualLineTerminators = 116,+ useShadowDOM = 117,+ useTabStops = 118,+ wordSeparators = 119,+ wordWrap = 120,+ wordWrapBreakAfterCharacters = 121,+ wordWrapBreakBeforeCharacters = 122,+ wordWrapColumn = 123,+ wordWrapOverride1 = 124,+ wordWrapOverride2 = 125,+ wrappingIndent = 126,+ wrappingStrategy = 127,+ showDeprecated = 128,+ inlayHints = 129,+ editorClassName = 130,+ pixelRatio = 131,+ tabFocusMode = 132,+ layoutInfo = 133,+ wrappingInfo = 134+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOptions.csnew file mode 100644index 000000000..8e28b24f5--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOptions.cs@@ -0,0 +1,764 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for the editor.+/// </summary>+public class EditorOptions+{+ /// <summary>+ /// This editor is used inside a diff editor.+ /// </summary>+ public bool? InDiffEditor { get; set; }++ /// <summary>+ /// The aria label for the editor's textarea (when it is focused).+ /// </summary>+ public string? AriaLabel { get; set; }++ /// <summary>+ /// The `tabindex` property of the editor's textarea+ /// </summary>+ public int? TabIndex { get; set; }++ /// <summary>+ /// Render vertical lines at the specified columns.+ /// Defaults to empty array.+ /// </summary>+ public int[]? Rulers { get; set; }++ /// <summary>+ /// A string containing the word separators used when doing word navigation.+ /// Defaults to `~!@#$%^&///()-=+[{]}\\|;:\'",.<>/?+ /// </summary>+ public string? WordSeparators { get; set; }++ /// <summary>+ /// Enable Linux primary clipboard.+ /// Defaults to true.+ /// </summary>+ public bool? SelectionClipboard { get; set; }++ /// <summary>+ /// Control the rendering of line numbers.+ /// If it is a function, it will be invoked when rendering a line number and the return value will be rendered.+ /// Otherwise, if it is a truthy, line numbers will be rendered normally (equivalent of using an identity function).+ /// Otherwise, line numbers will not be rendered.+ /// Defaults to `on`.+ /// </summary>+ public string? LineNumbers { get; set; }++ public Func<int, string>? LineNumbersLambda { get; set; }++ /// <summary>+ /// Controls the minimal number of visible leading and trailing lines surrounding the cursor.+ /// Defaults to 0.+ /// </summary>+ public int? CursorSurroundingLines { get; set; }++ /// <summary>+ /// Controls when `cursorSurroundingLines` should be enforced+ /// Defaults to `default`, `cursorSurroundingLines` is not enforced when cursor position is changed+ /// by mouse.+ /// </summary>+ public string? CursorSurroundingLinesStyle { get; set; }++ /// <summary>+ /// Render last line number when the file ends with a newline.+ /// Defaults to true.+ /// </summary>+ public bool? RenderFinalNewline { get; set; }++ /// <summary>+ /// Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).+ /// Defaults to 'prompt'.+ /// </summary>+ public string? UnusualLineTerminators { get; set; }++ /// <summary>+ /// Should the corresponding line be selected when clicking on the line number?+ /// Defaults to true.+ /// </summary>+ public bool? SelectOnLineNumbers { get; set; }++ /// <summary>+ /// Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.+ /// Defaults to 5.+ /// </summary>+ public int? LineNumbersMinChars { get; set; }++ /// <summary>+ /// Enable the rendering of the glyph margin.+ /// Defaults to true in vscode and to false in monaco-editor.+ /// </summary>+ public bool? GlyphMargin { get; set; }++ /// <summary>+ /// The width reserved for line decorations (in px).+ /// Line decorations are placed between line numbers and the editor content.+ /// You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.+ /// Defaults to 10.+ /// </summary>+ public int? LineDecorationsWidth { get; set; }++ public string? LineDecorationsWidthString { get; set; }++ /// <summary>+ /// When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.+ /// This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.+ /// Defaults to 30 (px).+ /// </summary>+ public int? RevealHorizontalRightPadding { get; set; }++ /// <summary>+ /// Render the editor selection with rounded borders.+ /// Defaults to true.+ /// </summary>+ public bool? RoundedSelection { get; set; }++ /// <summary>+ /// Class name to be added to the editor.+ /// </summary>+ public string? ExtraEditorClassName { get; set; }++ /// <summary>+ /// Should the editor be read only. See also `domReadOnly`.+ /// Defaults to false.+ /// </summary>+ public bool? ReadOnly { get; set; }++ /// <summary>+ /// Should the textarea used for input use the DOM `readonly` attribute.+ /// Defaults to false.+ /// </summary>+ public bool? DomReadOnly { get; set; }++ /// <summary>+ /// Enable linked editing.+ /// Defaults to false.+ /// </summary>+ public bool? LinkedEditing { get; set; }++ /// <summary>+ /// deprecated, use linkedEditing instead+ /// </summary>+ public bool? RenameOnType { get; set; }++ /// <summary>+ /// Should the editor render validation decorations.+ /// Defaults to editable.+ /// </summary>+ public string? RenderValidationDecorations { get; set; }++ /// <summary>+ /// Control the behavior and rendering of the scrollbars.+ /// </summary>+ public EditorScrollbarOptions? Scrollbar { get; set; }++ /// <summary>+ /// Control the behavior of experimental options+ /// </summary>+ public EditorExperimentalOptions? Experimental { get; set; }++ /// <summary>+ /// Control the behavior and rendering of the minimap.+ /// </summary>+ public EditorMinimapOptions? Minimap { get; set; }++ /// <summary>+ /// Control the behavior of the find widget.+ /// </summary>+ public EditorFindOptions? Find { get; set; }++ /// <summary>+ /// Display overflow widgets as `fixed`.+ /// Defaults to `false`.+ /// </summary>+ public bool? FixedOverflowWidgets { get; set; }++ /// <summary>+ /// The number of vertical lanes the overview ruler should render.+ /// Defaults to 3.+ /// </summary>+ public int? OverviewRulerLanes { get; set; }++ /// <summary>+ /// Controls if a border should be drawn around the overview ruler.+ /// Defaults to `true`.+ /// </summary>+ public bool? OverviewRulerBorder { get; set; }++ /// <summary>+ /// Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.+ /// Defaults to 'blink'.+ /// </summary>+ public string? CursorBlinking { get; set; }++ /// <summary>+ /// Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.+ /// Defaults to false.+ /// </summary>+ public bool? MouseWheelZoom { get; set; }++ /// <summary>+ /// Control the mouse pointer style, either 'text' or 'default' or 'copy'+ /// Defaults to 'text'+ /// </summary>+ public string? MouseStyle { get; set; }++ /// <summary>+ /// Enable smooth caret animation.+ /// Defaults to false.+ /// </summary>+ public bool? CursorSmoothCaretAnimation { get; set; }++ /// <summary>+ /// Control the cursor style, either 'block' or 'line'.+ /// Defaults to 'line'.+ /// </summary>+ public string? CursorStyle { get; set; }++ /// <summary>+ /// Control the width of the cursor when cursorStyle is set to 'line'+ /// </summary>+ public int? CursorWidth { get; set; }++ /// <summary>+ /// Enable font ligatures.+ /// Defaults to false.+ /// </summary>+ public bool? FontLigatures { get; set; }++ /// <summary>+ /// Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.+ /// The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.+ /// Defaults to false.+ /// </summary>+ public bool? DisableLayerHinting { get; set; }++ /// <summary>+ /// Disable the optimizations for monospace fonts.+ /// Defaults to false.+ /// </summary>+ public bool? DisableMonospaceOptimizations { get; set; }++ /// <summary>+ /// Should the cursor be hidden in the overview ruler.+ /// Defaults to false.+ /// </summary>+ public bool? HideCursorInOverviewRuler { get; set; }++ /// <summary>+ /// Enable that scrolling can go one screen size after the last line.+ /// Defaults to true.+ /// </summary>+ public bool? ScrollBeyondLastLine { get; set; }++ /// <summary>+ /// Enable that scrolling can go beyond the last column by a number of columns.+ /// Defaults to 5.+ /// </summary>+ public int? ScrollBeyondLastColumn { get; set; }++ /// <summary>+ /// Enable that the editor animates scrolling to a position.+ /// Defaults to false.+ /// </summary>+ public bool? SmoothScrolling { get; set; }++ /// <summary>+ /// Enable that the editor will install an interval to check if its container dom node size has changed.+ /// Enabling this might have a severe performance impact.+ /// Defaults to false.+ /// </summary>+ public bool? AutomaticLayout { get; set; }++ /// <summary>+ /// Control the wrapping of the editor.+ /// When `wordWrap` = "off", the lines will never wrap.+ /// When `wordWrap` = "on", the lines will wrap at the viewport width.+ /// When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.+ /// When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).+ /// Defaults to "off".+ /// </summary>+ public string? WordWrap { get; set; }++ /// <summary>+ /// Override the `wordWrap` setting.+ /// </summary>+ public string? WordWrapOverride1 { get; set; }++ /// <summary>+ /// Override the `wordWrapOverride1` setting.+ /// </summary>+ public string? WordWrapOverride2 { get; set; }++ /// <summary>+ /// Control the wrapping of the editor.+ /// When `wordWrap` = "off", the lines will never wrap.+ /// When `wordWrap` = "on", the lines will wrap at the viewport width.+ /// When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.+ /// When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).+ /// Defaults to 80.+ /// </summary>+ public int? WordWrapColumn { get; set; }++ /// <summary>+ /// Control indentation of wrapped lines. Can be: 'none', 'same', 'indent' or 'deepIndent'.+ /// Defaults to 'same' in vscode and to 'none' in monaco-editor.+ /// </summary>+ public string? WrappingIndent { get; set; }++ /// <summary>+ /// Controls the wrapping strategy to use.+ /// Defaults to 'simple'.+ /// </summary>+ public string? WrappingStrategy { get; set; }++ /// <summary>+ /// Configure word wrapping characters. A break will be introduced before these characters.+ /// </summary>+ public string? WordWrapBreakBeforeCharacters { get; set; }++ /// <summary>+ /// Configure word wrapping characters. A break will be introduced after these characters.+ /// </summary>+ public string? WordWrapBreakAfterCharacters { get; set; }++ /// <summary>+ /// Performance guard: Stop rendering a line after x characters.+ /// Defaults to 10000.+ /// Use -1 to never stop rendering+ /// </summary>+ public int? StopRenderingLineAfter { get; set; }++ /// <summary>+ /// Configure the editor's hover.+ /// </summary>+ public EditorHoverOptions? Hover { get; set; }++ /// <summary>+ /// Enable detecting links and making them clickable.+ /// Defaults to true.+ /// </summary>+ public bool? Links { get; set; }++ /// <summary>+ /// Enable inline color decorators and color picker rendering.+ /// </summary>+ public bool? ColorDecorators { get; set; }++ /// <summary>+ /// Control the behaviour of comments in the editor.+ /// </summary>+ public EditorCommentsOptions? Comments { get; set; }++ /// <summary>+ /// Enable custom contextmenu.+ /// Defaults to true.+ /// </summary>+ public bool? Contextmenu { get; set; }++ /// <summary>+ /// A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.+ /// Defaults to 1.+ /// </summary>+ public int? MouseWheelScrollSensitivity { get; set; }++ /// <summary>+ /// FastScrolling mulitplier speed when pressing `Alt`+ /// Defaults to 5.+ /// </summary>+ public int? FastScrollSensitivity { get; set; }++ /// <summary>+ /// Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.+ /// Defaults to true.+ /// </summary>+ public bool? ScrollPredominantAxis { get; set; }++ /// <summary>+ /// Enable that the selection with the mouse and keys is doing column selection.+ /// Defaults to false.+ /// </summary>+ public bool? ColumnSelection { get; set; }++ /// <summary>+ /// The modifier to be used to add multiple cursors with the mouse.+ /// Defaults to 'alt'+ /// </summary>+ public string? MultiCursorModifier { get; set; }++ /// <summary>+ /// Merge overlapping selections.+ /// Defaults to true+ /// </summary>+ public bool? MultiCursorMergeOverlapping { get; set; }++ /// <summary>+ /// Configure the behaviour when pasting a text with the line count equal to the cursor count.+ /// Defaults to 'spread'.+ /// </summary>+ public string? MultiCursorPaste { get; set; }++ /// <summary>+ /// Configure the editor's accessibility support.+ /// Defaults to 'auto'. It is best to leave this to 'auto'.+ /// </summary>+ public string? AccessibilitySupport { get; set; }++ /// <summary>+ /// Controls the number of lines in the editor that can be read out by a screen reader+ /// </summary>+ public int? AccessibilityPageSize { get; set; }++ /// <summary>+ /// Suggest options.+ /// </summary>+ public SuggestOptions? Suggest { get; set; }++ public InlineSuggestOptions? InlineSuggest { get; set; }++ /// <summary>+ /// Smart select options.+ /// </summary>+ public SmartSelectOptions? SmartSelect { get; set; }++ /// <summary>+ ///+ /// </summary>+ public GotoLocationOptions? GotoLocation { get; set; }++ /// <summary>+ /// Enable quick suggestions (shadow suggestions)+ /// Defaults to true.+ /// </summary>+ public QuickSuggestionsOptions? QuickSuggestions { get; set; }++ /// <summary>+ /// Quick suggestions show delay (in ms)+ /// Defaults to 10 (ms)+ /// </summary>+ public int? QuickSuggestionsDelay { get; set; }++ /// <summary>+ /// Controls the spacing around the editor.+ /// </summary>+ public EditorPaddingOptions? Padding { get; set; }++ /// <summary>+ /// Parameter hint options.+ /// </summary>+ public EditorParameterHintOptions? ParameterHints { get; set; }++ /// <summary>+ /// Options for auto closing brackets.+ /// Defaults to language defined behavior.+ /// </summary>+ public string? AutoClosingBrackets { get; set; }++ /// <summary>+ /// Options for auto closing quotes.+ /// Defaults to language defined behavior.+ /// </summary>+ public string? AutoClosingQuotes { get; set; }++ /// <summary>+ /// Options for pressing backspace near quotes or bracket pairs.+ /// </summary>+ public string? AutoClosingDelete { get; set; }++ /// <summary>+ /// Options for typing over closing quotes or brackets.+ /// </summary>+ public string? AutoClosingOvertype { get; set; }++ /// <summary>+ /// Options for auto surrounding.+ /// Defaults to always allowing auto surrounding.+ /// </summary>+ public string? AutoSurround { get; set; }++ /// <summary>+ /// Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.+ /// Defaults to advanced.+ /// </summary>+ public string? AutoIndent { get; set; }++ /// <summary>+ /// Emulate selection behaviour of tab characters when using spaces for indentation.+ /// This means selection will stick to tab stops.+ /// </summary>+ public bool? StickyTabStops { get; set; }++ /// <summary>+ /// Enable format on type.+ /// Defaults to false.+ /// </summary>+ public bool? FormatOnType { get; set; }++ /// <summary>+ /// Enable format on paste.+ /// Defaults to false.+ /// </summary>+ public bool? FormatOnPaste { get; set; }++ /// <summary>+ /// Controls if the editor should allow to move selections via drag and drop.+ /// Defaults to false.+ /// </summary>+ public bool? DragAndDrop { get; set; }++ /// <summary>+ /// Enable the suggestion box to pop-up on trigger characters.+ /// Defaults to true.+ /// </summary>+ public bool? SuggestOnTriggerCharacters { get; set; }++ /// <summary>+ /// Accept suggestions on ENTER.+ /// Defaults to 'on'.+ /// </summary>+ public string? AcceptSuggestionOnEnter { get; set; }++ /// <summary>+ /// Accept suggestions on provider defined characters.+ /// Defaults to true.+ /// </summary>+ public bool? AcceptSuggestionOnCommitCharacter { get; set; }++ /// <summary>+ /// Enable snippet suggestions. Default to 'true'.+ /// </summary>+ public string? SnippetSuggestions { get; set; }++ /// <summary>+ /// Copying without a selection copies the current line.+ /// </summary>+ public bool? EmptySelectionClipboard { get; set; }++ /// <summary>+ /// Syntax highlighting is copied.+ /// </summary>+ public bool? CopyWithSyntaxHighlighting { get; set; }++ /// <summary>+ /// The history mode for suggestions.+ /// </summary>+ public string? SuggestSelection { get; set; }++ /// <summary>+ /// The font size for the suggest widget.+ /// Defaults to the editor font size.+ /// </summary>+ public int? SuggestFontSize { get; set; }++ /// <summary>+ /// The line height for the suggest widget.+ /// Defaults to the editor line height.+ /// </summary>+ public int? SuggestLineHeight { get; set; }++ /// <summary>+ /// Enable tab completion.+ /// </summary>+ public string? TabCompletion { get; set; }++ /// <summary>+ /// Enable selection highlight.+ /// Defaults to true.+ /// </summary>+ public bool? SelectionHighlight { get; set; }++ /// <summary>+ /// Enable semantic occurrences highlight.+ /// Defaults to true.+ /// </summary>+ public bool? OccurrencesHighlight { get; set; }++ /// <summary>+ /// Show code lens+ /// Defaults to true.+ /// </summary>+ public bool? CodeLens { get; set; }++ /// <summary>+ /// Code lens font family. Defaults to editor font family.+ /// </summary>+ public string? CodeLensFontFamily { get; set; }++ /// <summary>+ /// Code lens font size. Default to 90% of the editor font size+ /// </summary>+ public int? CodeLensFontSize { get; set; }++ /// <summary>+ /// Control the behavior and rendering of the code action lightbulb.+ /// </summary>+ public EditorLightbulbOptions? Lightbulb { get; set; }++ /// <summary>+ /// Timeout for running code actions on save.+ /// </summary>+ public int? CodeActionsOnSaveTimeout { get; set; }++ /// <summary>+ /// Enable code folding.+ /// Defaults to true.+ /// </summary>+ public bool? Folding { get; set; }++ /// <summary>+ /// Selects the folding strategy. 'auto' uses the strategies contributed for the current document, 'indentation' uses the indentation based folding strategy.+ /// Defaults to 'auto'.+ /// </summary>+ public string? FoldingStrategy { get; set; }++ /// <summary>+ /// Enable highlight for folded regions.+ /// Defaults to true.+ /// </summary>+ public bool? FoldingHighlight { get; set; }++ /// <summary>+ /// Auto fold imports folding regions.+ /// Defaults to true.+ /// </summary>+ public bool? FoldingImportsByDefault { get; set; }++ /// <summary>+ /// Maximum number of foldable regions.+ /// Defaults to 5000.+ /// </summary>+ public int? FoldingMaximumRegions { get; set; }++ /// <summary>+ /// Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.+ /// Defaults to 'mouseover'.+ /// </summary>+ public string? ShowFoldingControls { get; set; }++ /// <summary>+ /// Controls whether clicking on the empty content after a folded line will unfold the line.+ /// Defaults to false.+ /// </summary>+ public bool? UnfoldOnClickAfterEndOfLine { get; set; }++ /// <summary>+ /// Enable highlighting of matching brackets.+ /// Defaults to 'always'.+ /// </summary>+ public string? MatchBrackets { get; set; }++ /// <summary>+ /// Enable rendering of whitespace.+ /// Defaults to 'selection'.+ /// </summary>+ public string? RenderWhitespace { get; set; }++ /// <summary>+ /// Enable rendering of control characters.+ /// Defaults to true.+ /// </summary>+ public bool? RenderControlCharacters { get; set; }++ /// <summary>+ /// Enable rendering of current line highlight.+ /// Defaults to all.+ /// </summary>+ public string? RenderLineHighlight { get; set; }++ /// <summary>+ /// Control if the current line highlight should be rendered only the editor is focused.+ /// Defaults to false.+ /// </summary>+ public bool? RenderLineHighlightOnlyWhenFocus { get; set; }++ /// <summary>+ /// Inserting and deleting whitespace follows tab stops.+ /// </summary>+ public bool? UseTabStops { get; set; }++ /// <summary>+ /// The font family+ /// </summary>+ public string? FontFamily { get; set; }++ /// <summary>+ /// The font weight+ /// </summary>+ public string? FontWeight { get; set; }++ /// <summary>+ /// The font size+ /// </summary>+ public int? FontSize { get; set; }++ /// <summary>+ /// The line height+ /// </summary>+ public int? LineHeight { get; set; }++ /// <summary>+ /// The letter spacing+ /// </summary>+ public int? LetterSpacing { get; set; }++ /// <summary>+ /// Controls fading out of unused variables.+ /// </summary>+ public bool? ShowUnused { get; set; }++ /// <summary>+ /// Controls whether to focus the inline editor in the peek widget by default.+ /// Defaults to false.+ /// </summary>+ public string? PeekWidgetDefaultFocus { get; set; }++ /// <summary>+ /// Controls whether the definition link opens element in the peek widget.+ /// Defaults to false.+ /// </summary>+ public bool? DefinitionLinkOpensInPeek { get; set; }++ /// <summary>+ /// Controls strikethrough deprecated variables.+ /// </summary>+ public bool? ShowDeprecated { get; set; }++ /// <summary>+ /// Control the behavior and rendering of the inline hints.+ /// </summary>+ public EditorInlayHintsOptions? InlayHints { get; set; }++ /// <summary>+ /// Control if the editor should use shadow DOM.+ /// </summary>+ public bool? UseShadowDOM { get; set; }++ /// <summary>+ /// Controls the behavior of editor guides.+ /// </summary>+ public GuidesOptions? Guides { get; set; }++ /// <summary>+ /// Controls the behavior of the unicode highlight feature+ /// (by default, ambiguous and invisible characters are highlighted).+ /// </summary>+ public UnicodeHighlightOptions? UnicodeHighlight { get; set; }++ /// <summary>+ /// Configures bracket pair colorization (disabled by default).+ /// </summary>+ public BracketPairColorizationOptions? BracketPairColorization { get; set; }++ /// <summary>+ /// Controls dropping into the editor from an external source.+ ///+ /// When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.+ /// </summary>+ public DropIntoEditorOptions? DropIntoEditor { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOverrideServices.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOverrideServices.csnew file mode 100644index 000000000..59eeb9152--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorOverrideServices.cs@@ -0,0 +1,9 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class EditorOverrideServices : Dictionary<string, object>+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorPaddingOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorPaddingOptions.csnew file mode 100644index 000000000..d774d89a2--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorPaddingOptions.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor padding+/// </summary>+public class EditorPaddingOptions+{+ /// <summary>+ /// Spacing between top edge of editor and first line.+ /// </summary>+ public float? Top { get; set; }++ /// <summary>+ /// Spacing between bottom edge of editor and last line.+ /// </summary>+ public float? Bottom { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorParameterHintOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorParameterHintOptions.csnew file mode 100644index 000000000..c53ba5cfe--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorParameterHintOptions.cs@@ -0,0 +1,23 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for parameter hints+/// </summary>+public class EditorParameterHintOptions+{+ /// <summary>+ /// Enable parameter hints.+ /// Defaults to true.+ /// </summary>+ public bool? Enabled { get; set; }++ /// <summary>+ /// Enable cycling of parameter hints.+ /// Defaults to false.+ /// </summary>+ public bool? Cycle { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorScrollbarOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorScrollbarOptions.csnew file mode 100644index 000000000..46a4a2ada--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorScrollbarOptions.cs@@ -0,0 +1,96 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor scrollbars+/// </summary>+public class EditorScrollbarOptions+{+ /// <summary>+ /// The size of arrows (if displayed).+ /// Defaults to 11.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public int? ArrowSize { get; set; }++ /// <summary>+ /// Render vertical scrollbar.+ /// Defaults to 'auto'.+ /// </summary>+ public string? Vertical { get; set; }++ /// <summary>+ /// Render horizontal scrollbar.+ /// Defaults to 'auto'.+ /// </summary>+ public string? Horizontal { get; set; }++ /// <summary>+ /// Cast horizontal and vertical shadows when the content is scrolled.+ /// Defaults to true.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public bool? UseShadows { get; set; }++ /// <summary>+ /// Render arrows at the top and bottom of the vertical scrollbar.+ /// Defaults to false.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public bool? VerticalHasArrows { get; set; }++ /// <summary>+ /// Render arrows at the left and right of the horizontal scrollbar.+ /// Defaults to false.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public bool? HorizontalHasArrows { get; set; }++ /// <summary>+ /// Listen to mouse wheel events and react to them by scrolling.+ /// Defaults to true.+ /// </summary>+ public bool? HandleMouseWheel { get; set; }++ /// <summary>+ /// Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).+ /// Defaults to true.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public bool? AlwaysConsumeMouseWheel { get; set; }++ /// <summary>+ /// Height in pixels for the horizontal scrollbar.+ /// Defaults to 10 (px).+ /// </summary>+ public int? HorizontalScrollbarSize { get; set; }++ /// <summary>+ /// Width in pixels for the vertical scrollbar.+ /// Defaults to 10 (px).+ /// </summary>+ public int? VerticalScrollbarSize { get; set; }++ /// <summary>+ /// Width in pixels for the vertical slider.+ /// Defaults to `verticalScrollbarSize`.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public int? VerticalSliderSize { get; set; }++ /// <summary>+ /// Height in pixels for the horizontal slider.+ /// Defaults to `horizontalScrollbarSize`.+ /// //////NOTE//////: This option cannot be updated using `updateOptions()`+ /// </summary>+ public int? HorizontalSliderSize { get; set; }++ /// <summary>+ /// Scroll gutter clicks move by page vs jump to position.+ /// Defaults to false.+ /// </summary>+ public bool? ScrollByPage { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorUpdateOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorUpdateOptions.csnew file mode 100644index 000000000..ac799de08--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EditorUpdateOptions.cs@@ -0,0 +1,31 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++// This class is not included in the monaco.d.ts file. It's added for translating the updateOptions method parameter+public class EditorUpdateOptions : EditorOptions, IGlobalEditorOptions+{+ public int? TabSize { get; set; }++ public bool? InsertSpaces { get; set; }++ public bool? DetectIndentation { get; set; }++ public bool? TrimAutoWhitespace { get; set; }++ public bool? LargeFileOptimizations { get; set; }++ public bool? WordBasedSuggestions { get; set; }++ public bool? WordBasedSuggestionsOnlySameLanguage { get; set; }++ public bool? StablePeek { get; set; }++ public int? MaxTokenizationLineLength { get; set; }++ public string Theme { get; set; } = BuiltinTheme.Vs;++ public bool? AutoDetectHighContrast { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EndOfLinePreference.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EndOfLinePreference.csnew file mode 100644index 000000000..53054eef5--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EndOfLinePreference.cs@@ -0,0 +1,26 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// End of line character preference.+/// </summary>+public enum EndOfLinePreference+{+ /// <summary>+ /// Use the end of line character identified in the text buffer.+ /// </summary>+ TextDefined = 0,++ /// <summary>+ /// Use line feed (\n) as the end of line character.+ /// </summary>+ LF = 1,++ /// <summary>+ /// Use carriage return and line feed (\r\n) as the end of line character.+ /// </summary>+ CRLF = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EndOfLineSequence.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EndOfLineSequence.csnew file mode 100644index 000000000..3e240e457--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/EndOfLineSequence.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// End of line character preference.+/// </summary>+public enum EndOfLineSequence+{+ /// <summary>+ /// Use line feed (\n) as the end of line character.+ /// </summary>+ LF = 0,++ /// <summary>+ /// Use carriage return and line feed (\r\n) as the end of line character.+ /// </summary>+ CRLF = 1+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/FindMatch.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/FindMatch.csnew file mode 100644index 000000000..a6c730e32--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/FindMatch.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class FindMatch+{+ public Range? Range { get; set; }++ public string[]? Matches { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/GotoLocationOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/GotoLocationOptions.csnew file mode 100644index 000000000..5f999c6a5--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/GotoLocationOptions.cs@@ -0,0 +1,33 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for go to location+/// </summary>+public class GotoLocationOptions+{+ public string? Multiple { get; set; }++ public string? MultipleDefinitions { get; set; }++ public string? MultipleTypeDefinitions { get; set; }++ public string? MultipleDeclarations { get; set; }++ public string? MultipleImplementations { get; set; }++ public string? MultipleReferences { get; set; }++ public string? AlternativeDefinitionCommand { get; set; }++ public string? AlternativeTypeDefinitionCommand { get; set; }++ public string? AlternativeDeclarationCommand { get; set; }++ public string? AlternativeImplementationCommand { get; set; }++ public string? AlternativeReferenceCommand { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/GuidesOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/GuidesOptions.csnew file mode 100644index 000000000..6a6e0a768--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/GuidesOptions.cs@@ -0,0 +1,38 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class GuidesOptions+{+ /// <summary>+ /// Enable rendering of bracket pair guides.+ /// Defaults to false.+ /// </summary>+ public string? BracketPairs { get; set; }++ /// <summary>+ /// Enable rendering of vertical bracket pair guides.+ /// Defaults to 'active'.+ /// </summary>+ public string? BracketPairsHorizontal { get; set; }++ /// <summary>+ /// Enable highlighting of the active bracket pair.+ /// Defaults to true.+ /// </summary>+ public bool? HighlightActiveBracketPair { get; set; }++ /// <summary>+ /// Enable rendering of indent guides.+ /// Defaults to true.+ /// </summary>+ public bool? Indentation { get; set; }++ /// <summary>+ /// Enable highlighting of the active indent guide.+ /// Defaults to true.+ /// </summary>+ public bool? HighlightActiveIndentation { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IDiffEditorBaseOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IDiffEditorBaseOptions.csnew file mode 100644index 000000000..1d46b0df5--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IDiffEditorBaseOptions.cs@@ -0,0 +1,73 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public interface IDiffEditorBaseOptions+{+ /// <summary>+ /// Allow the user to resize the diff editor split view.+ /// Defaults to true.+ /// </summary>+ bool? EnableSplitViewResizing { get; set; }++ /// <summary>+ /// Render the differences in two side-by-side editors.+ /// Defaults to true.+ /// </summary>+ bool? RenderSideBySide { get; set; }++ /// <summary>+ /// Timeout in milliseconds after which diff computation is cancelled.+ /// Defaults to 5000.+ /// </summary>+ int? MaxComputationTime { get; set; }++ /// <summary>+ /// Maximum supported file size in MB.+ /// Defaults to 50.+ /// </summary>+ int? MaxFileSize { get; set; }++ /// <summary>+ /// Compute the diff by ignoring leading/trailing whitespace+ /// Defaults to true.+ /// </summary>+ bool? IgnoreTrimWhitespace { get; set; }++ /// <summary>+ /// Render +/- indicators for added/deleted changes.+ /// Defaults to true.+ /// </summary>+ bool? RenderIndicators { get; set; }++ /// <summary>+ /// Shows icons in the glyph margin to revert changes.+ /// Default to true.+ /// </summary>+ bool? RenderMarginRevertIcon { get; set; }++ /// <summary>+ /// Original model should be editable?+ /// Defaults to false.+ /// </summary>+ bool? OriginalEditable { get; set; }++ /// <summary>+ /// Should the diff editor enable code lens?+ /// Defaults to false.+ /// </summary>+ bool? DiffCodeLens { get; set; }++ /// <summary>+ /// Is the diff editor should render overview ruler+ /// Defaults to true+ /// </summary>+ bool? RenderOverviewRuler { get; set; }++ /// <summary>+ /// Control the wrapping of the diff editor.+ /// </summary>+ string? DiffWordWrap { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IEditorOption.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IEditorOption.csnew file mode 100644index 000000000..4703c3708--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IEditorOption.cs@@ -0,0 +1,14 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class IEditorOption<V>+{+ public EditorOption Id { get; set; }++ public string? Name { get; set; }++ public V? DefaultValue { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IGlobalEditorOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IGlobalEditorOptions.csnew file mode 100644index 000000000..519cc674c--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IGlobalEditorOptions.cs@@ -0,0 +1,81 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Options which apply for all editors.+/// </summary>+public interface IGlobalEditorOptions+{+ /// <summary>+ /// The number of spaces a tab is equal to.+ /// This setting is overridden based on the file contents when `detectIndentation` is on.+ /// Defaults to 4.+ /// </summary>+ int? TabSize { get; set; }++ /// <summary>+ /// Insert spaces when pressing `Tab`.+ /// This setting is overridden based on the file contents when `detectIndentation` is on.+ /// Defaults to true.+ /// </summary>+ bool? InsertSpaces { get; set; }++ /// <summary>+ /// Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents.+ /// Defaults to true.+ /// </summary>+ bool? DetectIndentation { get; set; }++ /// <summary>+ /// Remove trailing auto inserted whitespace.+ /// Defaults to true.+ /// </summary>+ bool? TrimAutoWhitespace { get; set; }++ /// <summary>+ /// Special handling for large files to disable certain memory intensive features.+ /// Defaults to true.+ /// </summary>+ bool? LargeFileOptimizations { get; set; }++ /// <summary>+ /// Controls whether completions should be computed based on words in the document.+ /// Defaults to true.+ /// </summary>+ bool? WordBasedSuggestions { get; set; }++ /// <summary>+ /// Controls whether word based completions should be included from opened documents of the same language or any language.+ /// </summary>+ bool? WordBasedSuggestionsOnlySameLanguage { get; set; }++ /// <summary>+ /// Keep peek editors open even when double clicking their content or when hitting `Escape`.+ /// Defaults to false.+ /// </summary>+ bool? StablePeek { get; set; }++ /// <summary>+ /// Lines above this length will not be tokenized for performance reasons.+ /// Defaults to 20000.+ /// </summary>+ int? MaxTokenizationLineLength { get; set; }++ /// <summary>+ /// Theme to be used for rendering.+ /// The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'.+ /// You can create custom themes via `monaco.editor.defineTheme`.+ /// To switch a theme, use `monaco.editor.setTheme`.+ /// //////NOTE//////: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.+ /// </summary>+ string Theme { get; set; }++ /// <summary>+ /// If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.+ /// Defaults to true.+ /// </summary>+ bool? AutoDetectHighContrast { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IdentifiedSingleEditOperation.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IdentifiedSingleEditOperation.csnew file mode 100644index 000000000..b16a43caa--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/IdentifiedSingleEditOperation.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A single edit operation, that has an identifier.+/// </summary>+public class IdentifiedSingleEditOperation : SingleEditOperation+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InjectedTextCursorStops.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InjectedTextCursorStops.csnew file mode 100644index 000000000..b6c6abb32--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InjectedTextCursorStops.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum InjectedTextCursorStops+{+ Both = 0,++ Right = 1,++ Left = 2,++ None = 3+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InjectedTextOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InjectedTextOptions.csnew file mode 100644index 000000000..176aa8cfc--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InjectedTextOptions.cs@@ -0,0 +1,32 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configures text that is injected into the view without changing the underlying document.+/// </summary>+public class InjectedTextOptions+{+ /// <summary>+ /// Sets the text to inject. Must be a single line.+ /// </summary>+ public string? Content { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered inline with the text with this CSS class name.+ /// </summary>+ public string? InlineClassName { get; set; }++ /// <summary>+ /// If there is an `inlineClassName` which affects letter spacing.+ /// </summary>+ public bool? InlineClassNameAffectsLetterSpacing { get; set; }++ /// <summary>+ /// Configures cursor stops around injected text.+ /// Defaults to {@link InjectedTextCursorStops.Both}.+ /// </summary>+ public InjectedTextCursorStops? CursorStops { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InlineSuggestOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InlineSuggestOptions.csnew file mode 100644index 000000000..b70fa49f9--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/InlineSuggestOptions.cs@@ -0,0 +1,22 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class InlineSuggestOptions+{+ /// <summary>+ /// Enable or disable the rendering of automatic inline completions.+ /// </summary>+ public bool? Enabled { get; set; }++ /// <summary>+ /// Configures the mode.+ /// Use `prefix` to only show ghost text if the text to replace is a prefix of the suggestion text.+ /// Use `subword` to only show ghost text if the replace text is a subword of the suggestion text.+ /// Use `subwordSmart` to only show ghost text if the replace text is a subword of the suggestion text, but the subword must start after the cursor position.+ /// Defaults to `prefix`.+ /// </summary>+ public string? Mode { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MinimapPosition.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MinimapPosition.csnew file mode 100644index 000000000..5fd63e537--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MinimapPosition.cs@@ -0,0 +1,15 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Position in the minimap to render the decoration.+/// </summary>+public enum MinimapPosition+{+ Inline = 1,++ Gutter = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelChangedEvent.csnew file mode 100644index 000000000..0f83f6f85--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelChangedEvent.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that an editor has had its model reset (i.e. `editor.setModel()`).+/// </summary>+public class ModelChangedEvent+{+ /// <summary>+ /// The `uri` of the previous model or null.+ /// </summary>+ public string? OldModelUri { get; set; }++ /// <summary>+ /// The `uri` of the new model or null.+ /// </summary>+ public string? NewModelUri { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelContentChange.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelContentChange.csnew file mode 100644index 000000000..e26441dac--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelContentChange.cs@@ -0,0 +1,28 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ModelContentChange+{+ /// <summary>+ /// The range that got replaced.+ /// </summary>+ public Range? Range { get; set; }++ /// <summary>+ /// The offset of the range that got replaced.+ /// </summary>+ public int RangeOffset { get; set; }++ /// <summary>+ /// The length of the range that got replaced.+ /// </summary>+ public int RangeLength { get; set; }++ /// <summary>+ /// The new text for the range.+ /// </summary>+ public string? Text { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelContentChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelContentChangedEvent.csnew file mode 100644index 000000000..f3731f589--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelContentChangedEvent.cs@@ -0,0 +1,39 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing a change in the text of a model.+/// </summary>+public class ModelContentChangedEvent+{+ public List<ModelContentChange>? Changes { get; set; }++ /// <summary>+ /// The (new) end-of-line character.+ /// </summary>+ public string? Eol { get; set; }++ /// <summary>+ /// The new version id the model has transitioned to.+ /// </summary>+ public int VersionId { get; set; }++ /// <summary>+ /// Flag that indicates that this event was generated while undoing.+ /// </summary>+ public bool IsUndoing { get; set; }++ /// <summary>+ /// Flag that indicates that this event was generated while redoing.+ /// </summary>+ public bool IsRedoing { get; set; }++ /// <summary>+ /// Flag that indicates that all decorations were lost with this edit.+ /// The model has been reset to a new value.+ /// </summary>+ public bool IsFlush { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecoration.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecoration.csnew file mode 100644index 000000000..db87c6e49--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecoration.cs@@ -0,0 +1,31 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A decoration in the model.+/// </summary>+public class ModelDecoration+{+ /// <summary>+ /// Identifier for a decoration.+ /// </summary>+ public string? Id { get; set; }++ /// <summary>+ /// Identifier for a decoration's owner.+ /// </summary>+ public int OwnerId { get; set; }++ /// <summary>+ /// Range that this decoration covers.+ /// </summary>+ public Range? Range { get; set; }++ /// <summary>+ /// Options associated with this decoration.+ /// </summary>+ public ModelDecorationOptions? Options { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationMinimapOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationMinimapOptions.csnew file mode 100644index 000000000..39332cd52--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationMinimapOptions.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Options for rendering a model decoration in the overview ruler.+/// </summary>+public class ModelDecorationMinimapOptions : DecorationOptions+{+ /// <summary>+ /// The position in the overview ruler.+ /// </summary>+ public MinimapPosition Position { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationOptions.csnew file mode 100644index 000000000..88d902997--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationOptions.cs@@ -0,0 +1,113 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Options for a model decoration.+/// </summary>+public class ModelDecorationOptions+{+ /// <summary>+ /// Customize the growing behavior of the decoration when typing at the edges of the decoration.+ /// Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges+ /// </summary>+ public TrackedRangeStickiness? Stickiness { get; set; }++ /// <summary>+ /// CSS class name describing the decoration.+ /// </summary>+ public string? ClassName { get; set; }++ public string? BlockClassName { get; set; }++ /// <summary>+ /// Message to be rendered when hovering over the glyph margin decoration.+ /// </summary>+ public MarkdownString[]? GlyphMarginHoverMessage { get; set; }++ /// <summary>+ /// Array of MarkdownString to render as the decoration message.+ /// </summary>+ public MarkdownString[]? HoverMessage { get; set; }++ /// <summary>+ /// Should the decoration expand to encompass a whole line.+ /// </summary>+ public bool? IsWholeLine { get; set; }++ /// <summary>+ /// Always render the decoration (even when the range it encompasses is collapsed).+ /// </summary>+ public bool? ShowIfCollapsed { get; set; }++ /// <summary>+ /// Specifies the stack order of a decoration.+ /// A decoration with greater stack order is always in front of a decoration with+ /// a lower stack order when the decorations are on the same line.+ /// </summary>+ public int? ZIndex { get; set; }++ /// <summary>+ /// If set, render this decoration in the overview ruler.+ /// </summary>+ public ModelDecorationOverviewRulerOptions? OverviewRuler { get; set; }++ /// <summary>+ /// If set, render this decoration in the minimap.+ /// </summary>+ public ModelDecorationMinimapOptions? Minimap { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered in the glyph margin with this CSS class name.+ /// </summary>+ public string? GlyphMarginClassName { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered in the lines decorations with this CSS class name.+ /// </summary>+ public string? LinesDecorationsClassName { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered in the lines decorations with this CSS class name, but only for the first line in case of line wrapping.+ /// </summary>+ public string? FirstLineDecorationClassName { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name.+ /// </summary>+ public string? MarginClassName { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered inline with the text with this CSS class name.+ /// Please use this only for CSS rules that must impact the text. For example, use `className`+ /// to have a background color decoration.+ /// </summary>+ public string? InlineClassName { get; set; }++ /// <summary>+ /// If there is an `inlineClassName` which affects letter spacing.+ /// </summary>+ public bool? InlineClassNameAffectsLetterSpacing { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered before the text with this CSS class name.+ /// </summary>+ public string? BeforeContentClassName { get; set; }++ /// <summary>+ /// If set, the decoration will be rendered after the text with this CSS class name.+ /// </summary>+ public string? AfterContentClassName { get; set; }++ /// <summary>+ /// If set, text will be injected in the view after the range.+ /// </summary>+ public InjectedTextOptions? After { get; set; }++ /// <summary>+ /// If set, text will be injected in the view before the range.+ /// </summary>+ public InjectedTextOptions? Before { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationOverviewRulerOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationOverviewRulerOptions.csnew file mode 100644index 000000000..ed44f8a8b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationOverviewRulerOptions.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Options for rendering a model decoration in the overview ruler.+/// </summary>+public class ModelDecorationOverviewRulerOptions : DecorationOptions+{+ /// <summary>+ /// The position in the overview ruler.+ /// </summary>+ public OverviewRulerLane Position { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationsChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationsChangedEvent.csnew file mode 100644index 000000000..83cdc9e40--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDecorationsChangedEvent.cs@@ -0,0 +1,15 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that model decorations have changed.+/// </summary>+public class ModelDecorationsChangedEvent+{+ public bool AffectsMinimap { get; set; }++ public bool AffectsOverviewRuler { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDeltaDecoration.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDeltaDecoration.csnew file mode 100644index 000000000..a65767895--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelDeltaDecoration.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// New model decorations.+/// </summary>+public class ModelDeltaDecoration+{+ /// <summary>+ /// Range that this decoration covers.+ /// </summary>+ public Range? Range { get; set; }++ /// <summary>+ /// Options associated with this decoration.+ /// </summary>+ public ModelDecorationOptions? Options { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelLanguageChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelLanguageChangedEvent.csnew file mode 100644index 000000000..dd125a25c--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelLanguageChangedEvent.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that the current language associated with a model has changed.+/// </summary>+public class ModelLanguageChangedEvent+{+ /// <summary>+ /// Previous language+ /// </summary>+ public string? OldLanguage { get; set; }++ /// <summary>+ /// New language+ /// </summary>+ public string? NewLanguage { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelLanguageConfigurationChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelLanguageConfigurationChangedEvent.csnew file mode 100644index 000000000..046313335--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelLanguageConfigurationChangedEvent.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// An event describing that the language configuration associated with a model has changed.+/// </summary>+public class ModelLanguageConfigurationChangedEvent+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelOptionsChangedEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelOptionsChangedEvent.csnew file mode 100644index 000000000..ecc2f1961--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ModelOptionsChangedEvent.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ModelOptionsChangedEvent+{+ public bool TabSize { get; set; }++ public bool IndentSize { get; set; }++ public bool InsertSpaces { get; set; }++ public bool TrimAutoWhitespace { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentEmpty.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentEmpty.csnew file mode 100644index 000000000..c65ab62c2--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentEmpty.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetContentEmpty : BaseMouseTarget+{+ public new MouseTargetContentEmptyData? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentEmptyData.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentEmptyData.csnew file mode 100644index 000000000..838376fe0--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentEmptyData.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetContentEmptyData+{+ public bool IsAfterLines { get; set; }++ public float? HorizontalDistanceToText { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentText.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentText.csnew file mode 100644index 000000000..d4d990e92--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentText.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetContentText : BaseMouseTarget+{+ public new MouseTargetContentTextData? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentTextData.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentTextData.csnew file mode 100644index 000000000..c4addd4f5--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentTextData.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetContentTextData+{+ public string? MightBeForeignElement { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentWidget.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentWidget.csnew file mode 100644index 000000000..8e65515e3--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetContentWidget.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetContentWidget : BaseMouseTarget+{+ public new string? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetMargin.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetMargin.csnew file mode 100644index 000000000..464034d1b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetMargin.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetMargin : BaseMouseTarget+{+ public new MouseTargetMarginData? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetMarginData.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetMarginData.csnew file mode 100644index 000000000..b5822cd8f--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetMarginData.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetMarginData+{+ public bool IsAfterLines { get; set; }++ public float GlyphMarginLeft { get; set; }++ public float GlyphMarginWidth { get; set; }++ public float LineNumbersWidth { get; set; }++ public float OffsetX { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOutsideEditor.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOutsideEditor.csnew file mode 100644index 000000000..b494ea32b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOutsideEditor.cs@@ -0,0 +1,9 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetOutsideEditor : BaseMouseTarget+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOverlayWidget.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOverlayWidget.csnew file mode 100644index 000000000..ca036f09a--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOverlayWidget.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetOverlayWidget : BaseMouseTarget+{+ public new string? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOverviewRuler.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOverviewRuler.csnew file mode 100644index 000000000..286c35bc0--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetOverviewRuler.cs@@ -0,0 +1,9 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetOverviewRuler : BaseMouseTarget+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetScrollbar.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetScrollbar.csnew file mode 100644index 000000000..dadbfd90c--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetScrollbar.cs@@ -0,0 +1,9 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetScrollbar : BaseMouseTarget+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetTextarea.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetTextarea.csnew file mode 100644index 000000000..c6e922fe4--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetTextarea.cs@@ -0,0 +1,9 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetTextarea : BaseMouseTarget+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetType.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetType.csnew file mode 100644index 000000000..0030d781e--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetType.cs@@ -0,0 +1,81 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Type of hit element with the mouse in the editor.+/// </summary>+public enum MouseTargetType+{+ /// <summary>+ /// Mouse is on top of an unknown element.+ /// </summary>+ UNKNOWN = 0,++ /// <summary>+ /// Mouse is on top of the textarea used for input.+ /// </summary>+ TEXTAREA = 1,++ /// <summary>+ /// Mouse is on top of the glyph margin+ /// </summary>+ GUTTER_GLYPH_MARGIN = 2,++ /// <summary>+ /// Mouse is on top of the line numbers+ /// </summary>+ GUTTER_LINE_NUMBERS = 3,++ /// <summary>+ /// Mouse is on top of the line decorations+ /// </summary>+ GUTTER_LINE_DECORATIONS = 4,++ /// <summary>+ /// Mouse is on top of the whitespace left in the gutter by a view zone.+ /// </summary>+ GUTTER_VIEW_ZONE = 5,++ /// <summary>+ /// Mouse is on top of text in the content.+ /// </summary>+ CONTENT_TEXT = 6,++ /// <summary>+ /// Mouse is on top of empty space in the content (e.g. after line text or below last line)+ /// </summary>+ CONTENT_EMPTY = 7,++ /// <summary>+ /// Mouse is on top of a view zone in the content.+ /// </summary>+ CONTENT_VIEW_ZONE = 8,++ /// <summary>+ /// Mouse is on top of a content widget.+ /// </summary>+ CONTENT_WIDGET = 9,++ /// <summary>+ /// Mouse is on top of the decorations overview ruler.+ /// </summary>+ OVERVIEW_RULER = 10,++ /// <summary>+ /// Mouse is on top of a scrollbar.+ /// </summary>+ SCROLLBAR = 11,++ /// <summary>+ /// Mouse is on top of an overlay widget.+ /// </summary>+ OVERLAY_WIDGET = 12,++ /// <summary>+ /// Mouse is outside of the editor.+ /// </summary>+ OUTSIDE_EDITOR = 13+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetUnknown.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetUnknown.csnew file mode 100644index 000000000..2fac9c7ba--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetUnknown.cs@@ -0,0 +1,9 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetUnknown : BaseMouseTarget+{+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetViewZone.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetViewZone.csnew file mode 100644index 000000000..e45cd2b80--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetViewZone.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetViewZone : BaseMouseTarget+{+ public new MouseTargetViewZoneData? Detail { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetViewZoneData.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetViewZoneData.csnew file mode 100644index 000000000..fec1da15f--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/MouseTargetViewZoneData.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class MouseTargetViewZoneData+{+ public string? ViewZoneId { get; set; }++ public Position? PositionBefore { get; set; }++ public Position? PositionAfter { get; set; }++ public Position? Position { get; set; }++ public int AfterLineNumber { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/NewScrollPosition.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/NewScrollPosition.csnew file mode 100644index 000000000..0335cbc71--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/NewScrollPosition.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class NewScrollPosition+{+ public double ScrollLeft { get; set; }++ public double ScrollTop { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverlayWidgetPositionPreference.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverlayWidgetPositionPreference.csnew file mode 100644index 000000000..d4b284a41--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverlayWidgetPositionPreference.cs@@ -0,0 +1,26 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A positioning preference for rendering overlay widgets.+/// </summary>+public enum OverlayWidgetPositionPreference+{+ /// <summary>+ /// Position the overlay widget in the top right corner+ /// </summary>+ TOP_RIGHT_CORNER = 0,++ /// <summary>+ /// Position the overlay widget in the bottom right corner+ /// </summary>+ BOTTOM_RIGHT_CORNER = 1,++ /// <summary>+ /// Position the overlay widget in the top center+ /// </summary>+ TOP_CENTER = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverviewRulerLane.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverviewRulerLane.csnew file mode 100644index 000000000..3723aded1--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverviewRulerLane.cs@@ -0,0 +1,19 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Vertical Lane in the overview ruler of the editor.+/// </summary>+public enum OverviewRulerLane+{+ Left = 1,++ Center = 2,++ Right = 4,++ Full = 7+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverviewRulerPosition.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverviewRulerPosition.csnew file mode 100644index 000000000..d19665c2d--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/OverviewRulerPosition.cs@@ -0,0 +1,31 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A description for the overview ruler position.+/// </summary>+public class OverviewRulerPosition+{+ /// <summary>+ /// Width of the overview ruler+ /// </summary>+ public double Width { get; set; }++ /// <summary>+ /// Height of the overview ruler+ /// </summary>+ public double Height { get; set; }++ /// <summary>+ /// Top position for the overview ruler+ /// </summary>+ public double Top { get; set; }++ /// <summary>+ /// Right position for the overview ruler+ /// </summary>+ public double Right { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PartialEditorMouseEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PartialEditorMouseEvent.csnew file mode 100644index 000000000..a79f978db--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PartialEditorMouseEvent.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class PartialEditorMouseEvent+{+ public MouseEvent? Event { get; set; }++ public BaseMouseTarget? Target { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PasteEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PasteEvent.csnew file mode 100644index 000000000..e5623cfdf--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PasteEvent.cs@@ -0,0 +1,15 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A paste event originating from the editor.+/// </summary>+public class PasteEvent+{+ public Range? Range { get; set; }++ public string? LanguageId { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PositionAffinity.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PositionAffinity.csnew file mode 100644index 000000000..d4542993c--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/PositionAffinity.cs@@ -0,0 +1,33 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum PositionAffinity+{+ /// <summary>+ /// Prefers the left most position.+ /// </summary>+ Left = 0,++ /// <summary>+ /// Prefers the right most position.+ /// </summary>+ Right = 1,++ /// <summary>+ /// No preference.+ /// </summary>+ None = 2,++ /// <summary>+ /// If the given position is on injected text, prefers the position left of it.+ /// </summary>+ LeftOfInjectedText = 3,++ /// <summary>+ /// If the given position is on injected text, prefers the position right of it.+ /// </summary>+ RightOfInjectedText = 4+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/QuickSuggestionsOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/QuickSuggestionsOptions.csnew file mode 100644index 000000000..4a772ede7--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/QuickSuggestionsOptions.cs@@ -0,0 +1,17 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for quick suggestions+/// </summary>+public class QuickSuggestionsOptions+{+ public bool? Other { get; set; }++ public bool? Comments { get; set; }++ public bool? Strings { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/QuickSuggestionsValue.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/QuickSuggestionsValue.csnew file mode 100644index 000000000..6b1db7cc2--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/QuickSuggestionsValue.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public static class QuickSuggestionsValue+{+ public const string On = "on";+ public const string Inline = "inline";+ public const string Off = "off";+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/RenderLineNumbersType.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/RenderLineNumbersType.csnew file mode 100644index 000000000..5f2c42c57--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/RenderLineNumbersType.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum RenderLineNumbersType+{+ Off = 0,++ On = 1,++ Relative = 2,++ Interval = 3,++ Custom = 4+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/RenderMinimap.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/RenderMinimap.csnew file mode 100644index 000000000..34eb858b4--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/RenderMinimap.cs@@ -0,0 +1,14 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum RenderMinimap+{+ None = 0,++ Text = 1,++ Blocks = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ScrollType.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ScrollType.csnew file mode 100644index 000000000..5e9610d38--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ScrollType.cs@@ -0,0 +1,11 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum ScrollType+{+ Smooth = 0,+ Immediate = 1+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ScrollbarVisibility.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ScrollbarVisibility.csnew file mode 100644index 000000000..3815c555d--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ScrollbarVisibility.cs@@ -0,0 +1,14 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public enum ScrollbarVisibility+{+ Auto = 1,++ Hidden = 2,++ Visible = 3+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SingleEditOperation.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SingleEditOperation.csnew file mode 100644index 000000000..81b0a10b0--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SingleEditOperation.cs@@ -0,0 +1,28 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// A single edit operation, that acts as a simple replace.+/// i.e. Replace text at `range` with `text` in model.+/// </summary>+public class SingleEditOperation+{+ /// <summary>+ /// The range to replace. This can be empty to emulate a simple insert.+ /// </summary>+ public Range? Range { get; set; }++ /// <summary>+ /// The text to replace with. This can be null to emulate a simple delete.+ /// </summary>+ public string? Text { get; set; }++ /// <summary>+ /// This indicates that this operation has "insert" semantics.+ /// i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.+ /// </summary>+ public bool? ForceMoveMarkers { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SmartSelectOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SmartSelectOptions.csnew file mode 100644index 000000000..a92edb2cb--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SmartSelectOptions.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class SmartSelectOptions+{+ public bool? SelectLeadingAndTrailingWhitespace { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneDiffEditorConstructionOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneDiffEditorConstructionOptions.csnew file mode 100644index 000000000..e8360cdd7--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneDiffEditorConstructionOptions.cs@@ -0,0 +1,26 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The options to create a diff editor.+/// </summary>+public class StandaloneDiffEditorConstructionOptions : DiffEditorConstructionOptions+{+ /// <summary>+ /// Initial theme to be used for rendering.+ /// The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'.+ /// You can create custom themes via `monaco.editor.defineTheme`.+ /// To switch a theme, use `monaco.editor.setTheme`.+ /// //////NOTE//////: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.+ /// </summary>+ public string? Theme { get; set; }++ /// <summary>+ /// If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.+ /// Defaults to true.+ /// </summary>+ public bool? AutoDetectHighContrast { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneEditorConstructionOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneEditorConstructionOptions.csnew file mode 100644index 000000000..f47a06c44--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneEditorConstructionOptions.cs@@ -0,0 +1,69 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The options to create an editor.+/// </summary>+public sealed class StandaloneEditorConstructionOptions : EditorConstructionOptions, IGlobalEditorOptions+{+ /// <summary>+ /// The initial model associated with this code editor.+ /// </summary>+ public TextModel? Model { get; set; }++ /// <summary>+ /// The initial value of the auto created model in the editor.+ /// To not automatically create a model, use `model: null`.+ /// </summary>+ public string? Value { get; set; }++ /// <summary>+ /// The initial language of the auto created model in the editor.+ /// To not automatically create a model, use `model: null`.+ /// </summary>+ public string? Language { get; set; }++ /// <summary>+ /// Initial theme to be used for rendering.+ /// The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'.+ /// You can create custom themes via `monaco.editor.defineTheme`.+ /// To switch a theme, use `monaco.editor.setTheme`.+ /// //////NOTE//////: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.+ /// </summary>+ public string Theme { get; set; } = BuiltinTheme.Vs;++ /// <summary>+ /// If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.+ /// Defaults to true.+ /// </summary>+ public bool? AutoDetectHighContrast { get; set; } = true;++ /// <summary>+ /// An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in+ /// the accessibility help dialog in the editor.+ ///+ /// Defaults to "https://go.microsoft.com/fwlink/?linkid=852450"+ /// </summary>+ public string? AccessibilityHelpUrl { get; set; }++ public int? TabSize { get; set; }++ public bool? InsertSpaces { get; set; }++ public bool? DetectIndentation { get; set; }++ public bool? TrimAutoWhitespace { get; set; }++ public bool? LargeFileOptimizations { get; set; }++ public bool? WordBasedSuggestions { get; set; }++ public bool? WordBasedSuggestionsOnlySameLanguage { get; set; }++ public bool? StablePeek { get; set; }++ public int? MaxTokenizationLineLength { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneThemeData.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneThemeData.csnew file mode 100644index 000000000..98e6c0e23--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StandaloneThemeData.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class StandaloneThemeData+{+ public string? Base { get; set; }++ public bool Inherit { get; set; }++ public List<TokenThemeRule>? Rules { get; set; }++ public List<string>? EncodedTokensColors { get; set; }++ public Dictionary<string, string>? Colors { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StickyScrollOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StickyScrollOptions.csnew file mode 100644index 000000000..47de2d73f--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/StickyScrollOptions.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor sticky scroll+/// </summary>+public class StickyScrollOptions+{+ /// <summary>+ /// Enable the sticky scroll+ /// </summary>+ public bool? Enabled { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SuggestOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SuggestOptions.csnew file mode 100644index 000000000..f6d7ecb73--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/SuggestOptions.cs@@ -0,0 +1,201 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for editor suggest widget+/// </summary>+public class SuggestOptions+{+ /// <summary>+ /// Overwrite word ends on accept. Default to false.+ /// </summary>+ public string? InsertMode { get; set; }++ /// <summary>+ /// Enable graceful matching. Defaults to true.+ /// </summary>+ public bool? FilterGraceful { get; set; }++ /// <summary>+ /// Prevent quick suggestions when a snippet is active. Defaults to true.+ /// </summary>+ public bool? SnippetsPreventQuickSuggestions { get; set; }++ /// <summary>+ /// Favors words that appear close to the cursor.+ /// </summary>+ public bool? LocalityBonus { get; set; }++ /// <summary>+ /// Enable using global storage for remembering suggestions.+ /// </summary>+ public bool? ShareSuggestSelections { get; set; }++ /// <summary>+ /// Enable or disable icons in suggestions. Defaults to true.+ /// </summary>+ public bool? ShowIcons { get; set; }++ /// <summary>+ /// Enable or disable the suggest status bar.+ /// </summary>+ public bool? ShowStatusBar { get; set; }++ /// <summary>+ /// Enable or disable the rendering of the suggestion preview.+ /// </summary>+ public bool? Preview { get; set; }++ /// <summary>+ /// Configures the mode of the preview.+ /// </summary>+ public string? PreviewModel { get; set; }++ /// <summary>+ /// Show details inline with the label. Defaults to true.+ /// </summary>+ public bool? ShowInlineDetails { get; set; }++ /// <summary>+ /// Show method-suggestions.+ /// </summary>+ public bool? ShowMethods { get; set; }++ /// <summary>+ /// Show function-suggestions.+ /// </summary>+ public bool? ShowFunctions { get; set; }++ /// <summary>+ /// Show constructor-suggestions.+ /// </summary>+ public bool? ShowConstructors { get; set; }++ /// <summary>+ /// Show deprecated-suggestions.+ /// </summary>+ public bool? ShowDeprecated { get; set; }++ /// <summary>+ /// Show field-suggestions.+ /// </summary>+ public bool? ShowFields { get; set; }++ /// <summary>+ /// Show variable-suggestions.+ /// </summary>+ public bool? ShowVariables { get; set; }++ /// <summary>+ /// Show class-suggestions.+ /// </summary>+ public bool? ShowClasses { get; set; }++ /// <summary>+ /// Show struct-suggestions.+ /// </summary>+ public bool? ShowStructs { get; set; }++ /// <summary>+ /// Show interface-suggestions.+ /// </summary>+ public bool? ShowInterfaces { get; set; }++ /// <summary>+ /// Show module-suggestions.+ /// </summary>+ public bool? ShowModules { get; set; }++ /// <summary>+ /// Show property-suggestions.+ /// </summary>+ public bool? ShowProperties { get; set; }++ /// <summary>+ /// Show event-suggestions.+ /// </summary>+ public bool? ShowEvents { get; set; }++ /// <summary>+ /// Show operator-suggestions.+ /// </summary>+ public bool? ShowOperators { get; set; }++ /// <summary>+ /// Show unit-suggestions.+ /// </summary>+ public bool? ShowUnits { get; set; }++ /// <summary>+ /// Show value-suggestions.+ /// </summary>+ public bool? ShowValues { get; set; }++ /// <summary>+ /// Show constant-suggestions.+ /// </summary>+ public bool? ShowConstants { get; set; }++ /// <summary>+ /// Show enum-suggestions.+ /// </summary>+ public bool? ShowEnums { get; set; }++ /// <summary>+ /// Show enumMember-suggestions.+ /// </summary>+ public bool? ShowEnumMembers { get; set; }++ /// <summary>+ /// Show keyword-suggestions.+ /// </summary>+ public bool? ShowKeywords { get; set; }++ /// <summary>+ /// Show text-suggestions.+ /// </summary>+ public bool? ShowWords { get; set; }++ /// <summary>+ /// Show color-suggestions.+ /// </summary>+ public bool? ShowColors { get; set; }++ /// <summary>+ /// Show file-suggestions.+ /// </summary>+ public bool? ShowFiles { get; set; }++ /// <summary>+ /// Show reference-suggestions.+ /// </summary>+ public bool? ShowReferences { get; set; }++ /// <summary>+ /// Show folder-suggestions.+ /// </summary>+ public bool? ShowFolders { get; set; }++ /// <summary>+ /// Show typeParameter-suggestions.+ /// </summary>+ public bool? ShowTypeParameters { get; set; }++ /// <summary>+ /// Show issue-suggestions.+ /// </summary>+ public bool? ShowIssues { get; set; }++ /// <summary>+ /// Show user-suggestions.+ /// </summary>+ public bool? ShowUsers { get; set; }++ /// <summary>+ /// Show snippet-suggestions.+ /// </summary>+ public bool? ShowSnippets { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextEditorCursorBlinkingStyle.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextEditorCursorBlinkingStyle.csnew file mode 100644index 000000000..96c97d46f--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextEditorCursorBlinkingStyle.cs@@ -0,0 +1,41 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The kind of animation in which the editor's cursor should be rendered.+/// </summary>+public enum TextEditorCursorBlinkingStyle+{+ /// <summary>+ /// Hidden+ /// </summary>+ Hidden = 0,++ /// <summary>+ /// Blinking+ /// </summary>+ Blink = 1,++ /// <summary>+ /// Blinking with smooth fading+ /// </summary>+ Smooth = 2,++ /// <summary>+ /// Blinking with prolonged filled state and smooth fading+ /// </summary>+ Phase = 3,++ /// <summary>+ /// Expand collapse animation on the y axis+ /// </summary>+ Expand = 4,++ /// <summary>+ /// No-Blinking+ /// </summary>+ Solid = 5+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextEditorCursorStyle.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextEditorCursorStyle.csnew file mode 100644index 000000000..781f96935--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextEditorCursorStyle.cs@@ -0,0 +1,41 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// The style in which the editor's cursor should be rendered.+/// </summary>+public enum TextEditorCursorStyle+{+ /// <summary>+ /// As a vertical line (sitting between two characters).+ /// </summary>+ Line = 1,++ /// <summary>+ /// As a block (sitting on top of a character).+ /// </summary>+ Block = 2,++ /// <summary>+ /// As a horizontal line (sitting under a character).+ /// </summary>+ Underline = 3,++ /// <summary>+ /// As a thin vertical line (sitting between two characters).+ /// </summary>+ LineThin = 4,++ /// <summary>+ /// As an outlined block (sitting on top of a character).+ /// </summary>+ BlockOutline = 5,++ /// <summary>+ /// As a thin horizontal line (sitting under a character).+ /// </summary>+ UnderlineThin = 6+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextModelResolvedOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextModelResolvedOptions.csnew file mode 100644index 000000000..4657f8601--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextModelResolvedOptions.cs@@ -0,0 +1,20 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class TextModelResolvedOptions+{+ public int TabSize { get; set; }++ public int IndentSize { get; set; }++ public bool InsertSpaces { get; set; }++ public DefaultEndOfLine DefaultEOL { get; set; }++ public bool TrimAutoWhitespace { get; set; }++ public BracketPairColorizationOptions? BracketPairColorizationOptions { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextModelUpdateOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextModelUpdateOptions.csnew file mode 100644index 000000000..957f66b33--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TextModelUpdateOptions.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class TextModelUpdateOptions+{+ public int? TabSize { get; set; }++ public int? IndentSize { get; set; }++ public bool? InsertSpaces { get; set; }++ public bool? TrimAutoWhitespace { get; set; }++ public BracketPairColorizationOptions? BracketColorizationOptions { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ThemeColor.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ThemeColor.csnew file mode 100644index 000000000..d1b265c7c--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ThemeColor.cs@@ -0,0 +1,10 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ThemeColor+{+ public string? Id { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TokenThemeRule.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TokenThemeRule.csnew file mode 100644index 000000000..b31d04e00--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TokenThemeRule.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class TokenThemeRule+{+ public string? Token { get; set; }++ public string? Foreground { get; set; }++ public string? Background { get; set; }++ public string? FontStyle { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TrackedRangeStickiness.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TrackedRangeStickiness.csnew file mode 100644index 000000000..775e757cb--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/TrackedRangeStickiness.cs@@ -0,0 +1,17 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Describes the behavior of decorations when typing/editing near their edges.+/// Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`+/// </summary>+public enum TrackedRangeStickiness+{+ AlwaysGrowsWhenTypingAtEdges = 0,+ NeverGrowsWhenTypingAtEdges = 1,+ GrowsOnlyWhenTypingBefore = 2,+ GrowsOnlyWhenTypingAfter = 3+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/UnicodeHighlightOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/UnicodeHighlightOptions.csnew file mode 100644index 000000000..4e2e5caf1--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/UnicodeHighlightOptions.cs@@ -0,0 +1,36 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Configuration options for unicode highlighting.+/// </summary>+public class UnicodeHighlightOptions+{+ /// <summary>+ /// Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.+ /// </summary>+ public bool? NonBasicASCII { get; set; }++ /// <summary>+ /// Controls whether characters that just reserve space or have no width at all are highlighted.+ /// </summary>+ public bool? InvisibleCharacters { get; set; }++ /// <summary>+ /// Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.+ /// </summary>+ public bool? AmbiguousCharacters { get; set; }++ /// <summary>+ /// Controls whether characters in comments should also be subject to unicode highlighting.+ /// </summary>+ public bool? IncludeComments { get; set; }++ /// <summary>+ /// Controls whether characters in strings should also be subject to unicode highlighting.+ /// </summary>+ public bool? IncludeStrings { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ValidEditOperation.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ValidEditOperation.csnew file mode 100644index 000000000..b4f27b19d--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/ValidEditOperation.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class ValidEditOperation+{+ /// <summary>+ /// The range to replace. This can be empty to emulate a simple insert.+ /// </summary>+ public Range? Range { get; set; }++ /// <summary>+ /// The text to replace with. This can be empty to emulate a simple delete.+ /// </summary>+ public string? Text { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WebWorkerOptions.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WebWorkerOptions.csnew file mode 100644index 000000000..a70a3251d--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WebWorkerOptions.cs@@ -0,0 +1,35 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++public class WebWorkerOptions+{+ /// <summary>+ /// The AMD moduleId to load.+ /// It should export a function `create` that should return the exported proxy.+ /// </summary>+ public string? ModuleId { get; set; }++ /// <summary>+ /// The data to send over when calling create on the module.+ /// </summary>+ public object? CreateData { get; set; }++ /// <summary>+ /// A label to be used to identify the web worker for debugging purposes.+ /// </summary>+ public string? Label { get; set; }++ /// <summary>+ /// An object that can be used by the web worker to make calls back to the main thread.+ /// </summary>+ public object? Host { get; set; }++ /// <summary>+ /// Keep idle models.+ /// Defaults to false, which means that idle models will stop syncing after a while.+ /// </summary>+ public bool? KeepIdleModels { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WordAtPosition.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WordAtPosition.csnew file mode 100644index 000000000..acc69787a--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WordAtPosition.cs@@ -0,0 +1,26 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Word inside a model.+/// </summary>+public class WordAtPosition+{+ /// <summary>+ /// The word.+ /// </summary>+ public string? Word { get; set; }++ /// <summary>+ /// The column where the word starts.+ /// </summary>+ public int StartColumn { get; set; }++ /// <summary>+ /// The column where the word ends.+ /// </summary>+ public int EndColumn { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WrappingIndent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WrappingIndent.csnew file mode 100644index 000000000..262ff1e1a--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Editor/WrappingIndent.cs@@ -0,0 +1,31 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco.Editor;++/// <summary>+/// Describes how to indent wrapped lines.+/// </summary>+public enum WrappingIndent+{+ /// <summary>+ /// No indentation => wrapped lines begin at column 1.+ /// </summary>+ None = 0,++ /// <summary>+ /// Same => wrapped lines get the same indentation as the parent.+ /// </summary>+ Same = 1,++ /// <summary>+ /// Indent => wrapped lines get +1 indentation toward the parent.+ /// </summary>+ Indent = 2,++ /// <summary>+ /// DeepIndent => wrapped lines get +2 indentation toward the parent.+ /// </summary>+ DeepIndent = 3+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Environment.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Environment.csnew file mode 100644index 000000000..2559915b9--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Environment.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class Environment+{+ public bool? GlobalAPI { get; set; }++ public string? BaseUrl { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyCode.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyCode.csnew file mode 100644index 000000000..dce8696d7--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyCode.cs@@ -0,0 +1,206 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++/// <summary>+/// Virtual Key Codes, the value does not hold any inherent meaning.+/// Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx+/// But these are "more general", as they should work across browsers & OS`s.+/// </summary>+public enum KeyCode+{+ DependsOnKbLayout = -1,+ /// <summary>+ /// Placed first to cover the 0 value of the enum.+ /// </summary>+ Unknown = 0,+ Backspace = 1,+ Tab = 2,+ Enter = 3,+ Shift = 4,+ Ctrl = 5,+ Alt = 6,+ PauseBreak = 7,+ CapsLock = 8,+ Escape = 9,+ Space = 10,+ PageUp = 11,+ PageDown = 12,+ End = 13,+ Home = 14,+ LeftArrow = 15,+ UpArrow = 16,+ RightArrow = 17,+ DownArrow = 18,+ Insert = 19,+ Delete = 20,+ Digit0 = 21,+ Digit1 = 22,+ Digit2 = 23,+ Digit3 = 24,+ Digit4 = 25,+ Digit5 = 26,+ Digit6 = 27,+ Digit7 = 28,+ Digit8 = 29,+ Digit9 = 30,+ KeyA = 31,+ KeyB = 32,+ KeyC = 33,+ KeyD = 34,+ KeyE = 35,+ KeyF = 36,+ KeyG = 37,+ KeyH = 38,+ KeyI = 39,+ KeyJ = 40,+ KeyK = 41,+ KeyL = 42,+ KeyM = 43,+ KeyN = 44,+ KeyO = 45,+ KeyP = 46,+ KeyQ = 47,+ KeyR = 48,+ KeyS = 49,+ KeyT = 50,+ KeyU = 51,+ KeyV = 52,+ KeyW = 53,+ KeyX = 54,+ KeyY = 55,+ KeyZ = 56,+ Meta = 57,+ ContextMenu = 58,+ F1 = 59,+ F2 = 60,+ F3 = 61,+ F4 = 62,+ F5 = 63,+ F6 = 64,+ F7 = 65,+ F8 = 66,+ F9 = 67,+ F10 = 68,+ F11 = 69,+ F12 = 70,+ F13 = 71,+ F14 = 72,+ F15 = 73,+ F16 = 74,+ F17 = 75,+ F18 = 76,+ F19 = 77,+ NumLock = 78,+ ScrollLock = 79,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the ';:' key+ /// </summary>+ Semicolon = 80,+ /// <summary>+ /// For any country/region, the '+' key+ /// For the US standard keyboard, the '=+' key+ /// </summary>+ Equal = 81,+ /// <summary>+ /// For any country/region, the ',' key+ /// For the US standard keyboard, the ',<' key+ /// </summary>+ Comma = 82,+ /// <summary>+ /// For any country/region, the '-' key+ /// For the US standard keyboard, the '-_' key+ /// </summary>+ Minus = 83,+ /// <summary>+ /// For any country/region, the '.' key+ /// For the US standard keyboard, the '.>' key+ /// </summary>+ Period = 84,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the '/?' key+ /// </summary>+ Slash = 85,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the '`~' key+ /// </summary>+ Backquote = 86,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the '[{' key+ /// </summary>+ BracketLeft = 87,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the '\|' key+ /// </summary>+ Backslash = 88,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the ']}' key+ /// </summary>+ BracketRight = 89,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// For the US standard keyboard, the ''"' key+ /// </summary>+ Quote = 90,+ /// <summary>+ /// Used for miscellaneous characters; it can vary by keyboard.+ /// </summary>+ OEM_8 = 91,+ /// <summary>+ /// Either the angle bracket key or the backslash key on the RT 102-key keyboard.+ /// </summary>+ IntlBackslash = 92,+ Numpad0 = 93,+ Numpad1 = 94,+ Numpad2 = 95,+ Numpad3 = 96,+ Numpad4 = 97,+ Numpad5 = 98,+ Numpad6 = 99,+ Numpad7 = 100,+ Numpad8 = 101,+ Numpad9 = 102,+ NumpadMultiply = 103,+ NumpadAdd = 104,+ NUMPAD_SEPARATOR = 105,+ NumpadSubtract = 106,+ NumpadDecimal = 107,+ NumpadDivide = 108,+ /// <summary>+ /// Cover all key codes when IME is processing input.+ /// </summary>+ KEY_IN_COMPOSITION = 109,+ ABNT_C1 = 110,+ ABNT_C2 = 111,+ AudioVolumeMute = 112,+ AudioVolumeUp = 113,+ AudioVolumeDown = 114,+ BrowserSearch = 115,+ BrowserHome = 116,+ BrowserBack = 117,+ BrowserForward = 118,+ MediaTrackNext = 119,+ MediaTrackPrevious = 120,+ MediaStop = 121,+ MediaPlayPause = 122,+ LaunchMediaPlayer = 123,+ LaunchMail = 124,+ LaunchApp2 = 125,+ /// <summary>+ /// VK_CLEAR, 0x0C, CLEAR key+ /// </summary>+ Clear = 126,+ /// <summary>+ /// Placed last to cover the length of the enum.+ /// Please do not depend on this value!+ /// </summary>+ MAX_VALUE = 127+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyMod.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyMod.csnew file mode 100644index 000000000..f8fd3cb17--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyMod.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public enum KeyMod+{+ CtrlCmd = 2048,++ Shift = 1024,++ Alt = 512,++ WinCtrl = 256+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyboardEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyboardEvent.csnew file mode 100644index 000000000..096ea2b38--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/KeyboardEvent.cs@@ -0,0 +1,26 @@+using System.Text.Json;++///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class KeyboardEvent+{+ public KeyboardEvent? BrowserEvent { get; set; }++ public JsonElement? Target { get; set; }++ public bool CtrlKey { get; set; }++ public bool ShiftKey { get; set; }++ public bool AltKey { get; set; }++ public bool MetaKey { get; set; }++ public KeyCode KeyCode { get; set; }++ public string? Code { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkdownString.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkdownString.csnew file mode 100644index 000000000..11b02ecc5--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkdownString.cs@@ -0,0 +1,19 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class MarkdownString+{+ public string? Value { get; set; }+++ public bool? IsTrusted { get; set; }++ public bool? SupportThemeIcons { get; set; }++ public bool? SupportHtml { get; set; }++ public UriComponents? BaseUri { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkerSeverity.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkerSeverity.csnew file mode 100644index 000000000..77a55e865--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkerSeverity.cs@@ -0,0 +1,16 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public enum MarkerSeverity+{+ Hint = 1,++ Info = 2,++ Warning = 4,++ Error = 8+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkerTag.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkerTag.csnew file mode 100644index 000000000..3539143fb--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MarkerTag.cs@@ -0,0 +1,12 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public enum MarkerTag+{+ Unnecessary = 1,++ Deprecated = 2+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MouseEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MouseEvent.csnew file mode 100644index 000000000..d20bb2730--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/MouseEvent.cs@@ -0,0 +1,38 @@+using System.Text.Json;++///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class MouseEvent+{+ public MouseEvent? BrowserEvent { get; set; }++ public bool LeftButton { get; set; }++ public bool MiddleButton { get; set; }++ public bool RightButton { get; set; }++ public int Buttons { get; set; }++ public JsonElement? Target { get; set; }++ public int Detail { get; set; }++ public double Posx { get; set; }++ public double Posy { get; set; }++ public bool CtrlKey { get; set; }++ public bool ShiftKey { get; set; }++ public bool AltKey { get; set; }++ public bool MetaKey { get; set; }++ public long Timestamp { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Position.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Position.csnew file mode 100644index 000000000..e5a518011--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Position.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++/// <summary>+/// A position in the editor. This interface is suitable for serialization.+/// </summary>+public class Position+{+ /// <summary>+ /// line number (starts at 1)+ /// </summary>+ public int LineNumber { get; set; }++ /// <summary>+ /// column (the first character in a line is between column 1 and column 2)+ /// </summary>+ public int Column { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Range.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Range.csnew file mode 100644index 000000000..fe4441dc2--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Range.cs@@ -0,0 +1,41 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++/// <summary>+/// A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)+/// </summary>+public class Range+{+ /// <summary>+ /// Line number on which the range starts (starts at 1).+ /// </summary>+ public int StartLineNumber { get; set; }++ /// <summary>+ /// Column on which the range starts in line `startLineNumber` (starts at 1).+ /// </summary>+ public int StartColumn { get; set; }++ /// <summary>+ /// Line number on which the range ends.+ /// </summary>+ public int EndLineNumber { get; set; }++ /// <summary>+ /// Column on which the range ends in line `endLineNumber`.+ /// </summary>+ public int EndColumn { get; set; }++ public Range() { }++ public Range(int startLineNumber, int startColumn, int endLineNumber, int endColumn)+ {+ StartLineNumber = startLineNumber;+ StartColumn = startColumn;+ EndLineNumber = endLineNumber;+ EndColumn = endColumn;+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/ScrollEvent.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/ScrollEvent.csnew file mode 100644index 000000000..d3543ed2a--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/ScrollEvent.cs@@ -0,0 +1,24 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class ScrollEvent+{+ public double ScrollTop { get; set; }++ public double ScrollLeft { get; set; }++ public double ScrollWidth { get; set; }++ public double ScrollHeight { get; set; }++ public bool ScrollTopChanged { get; set; }++ public bool ScrollLeftChanged { get; set; }++ public bool ScrollWidthChanged { get; set; }++ public bool ScrollHeightChanged { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/ScrolledVisiblePosition.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/ScrolledVisiblePosition.csnew file mode 100644index 000000000..6ec6a30d4--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/ScrolledVisiblePosition.cs@@ -0,0 +1,14 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class ScrolledVisiblePosition+{+ public int Left { get; set; }++ public int Top { get; set; }++ public int Height { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Selection.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Selection.csnew file mode 100644index 000000000..7418899cb--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Selection.cs@@ -0,0 +1,32 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++/// <summary>+/// A selection in the editor.+/// The selection is a range that has an orientation.+/// </summary>+public class Selection : Range+{+ /// <summary>+ /// The line number on which the selection has started.+ /// </summary>+ public int SelectionStartLineNumber { get; set; }++ /// <summary>+ /// The column on `selectionStartLineNumber` where the selection has started.+ /// </summary>+ public int SelectionStartColumn { get; set; }++ /// <summary>+ /// The line number on which the selection has ended.+ /// </summary>+ public int PositionLineNumber { get; set; }++ /// <summary>+ /// The column on `positionLineNumber` where the selection has ended.+ /// </summary>+ public int PositionColumn { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/SelectionDirection.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/SelectionDirection.csnew file mode 100644index 000000000..f508ccefd--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/SelectionDirection.cs@@ -0,0 +1,21 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++/// <summary>+/// The direction of a selection.+/// </summary>+public enum SelectionDirection+{+ /// <summary>+ /// The selection starts above where it ends.+ /// </summary>+ LTR = 0,++ /// <summary>+ /// The selection starts below where it ends.+ /// </summary>+ RTL = 1+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/TextModel.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/TextModel.csnew file mode 100644index 000000000..a84f748ef--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/TextModel.cs@@ -0,0 +1,427 @@+using DevToys.Blazor.Components.Monaco.Editor;++namespace DevToys.Blazor.Components.Monaco;++/// <summary>+/// A model.+/// </summary>+public class TextModel+{+ /// <summary>+ /// Gets the resource associated with this editor model.+ /// </summary>+ public string? Uri { get; set; }++ /// <summary>+ /// A unique identifier associated with this model.+ /// </summary>+ public string? Id { get; set; }++ /// <summary>+ /// Get the resolved options for this model.+ /// </summary>+ public ValueTask<TextModelResolvedOptions> GetOptionsAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<TextModelResolvedOptions>("devtoys.MonacoEditor.model.getOptions", Uri);++ /// <summary>+ /// Get the current version id of the model.+ /// Anytime a change happens to the model (even undo/redo),+ /// the version id is incremented.+ /// </summary>+ public ValueTask<int> GetVersionIdAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getVersionId", Uri);++ /// <summary>+ /// Get the alternative version id of the model.+ /// This alternative version id is not always incremented,+ /// it will return the same values in the case of undo-redo.+ /// </summary>+ public ValueTask<int> GetAlternativeVersionIdAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getAlternativeVersionId", Uri);++ /// <summary>+ /// Replace the entire text buffer value contained in this model.+ /// </summary>+ public ValueTask<bool> SetValueAsync(IJSRuntime runtime, string newValue)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.setValue", Uri, newValue);++ /// <summary>+ /// Get the text stored in this model.+ /// @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.+ /// @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.+ /// @return The text.+ /// </summary>+ public ValueTask<string> GetValueAsync(IJSRuntime runtime, EndOfLinePreference? eol, bool? preserveBOM)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.model.getValue", Uri, eol, preserveBOM);++ /// <summary>+ /// Get the length of the text stored in this model.+ /// </summary>+ public ValueTask<int> GetValueLengthAsync(IJSRuntime runtime, EndOfLinePreference? eol, bool? preserveBOM)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getValueLength", Uri, eol, preserveBOM);++ /// <summary>+ /// Get the text in a certain range.+ /// @param range The range describing what text to get.+ /// @param eol The end of line character preference. This will only be used for multiline ranges. Defaults to `EndOfLinePreference.TextDefined`.+ /// @return The text.+ /// </summary>+ public ValueTask<string> GetValueInRangeAsync(IJSRuntime runtime, Range range, EndOfLinePreference? eol)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.model.getValueInRange", Uri, range, eol);++ /// <summary>+ /// Get the length of text in a certain range.+ /// @param range The range describing what text length to get.+ /// @return The text length.+ /// </summary>+ public ValueTask<int> GetValueLengthInRangeAsync(IJSRuntime runtime, Range range)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getValueLengthInRange", Uri, range);++ /// <summary>+ /// Get the character count of text in a certain range.+ /// @param range The range describing what text length to get.+ /// </summary>+ public ValueTask<int> GetCharacterCountInRangeAsync(IJSRuntime runtime, Range range)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getCharacterCountInRange", Uri, range);++ /// <summary>+ /// Get the number of lines in the model.+ /// </summary>+ public ValueTask<int> GetLineCountAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getLineCount", Uri);++ /// <summary>+ /// Get the text for a certain line.+ /// </summary>+ public ValueTask<string> GetLineContentAsync(IJSRuntime runtime, int lineNumber)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.model.getLineContent", Uri, lineNumber);++ /// <summary>+ /// Get the text length for a certain line.+ /// </summary>+ public ValueTask<int> GetLineLengthAsync(IJSRuntime runtime, int lineNumber)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getLineLength", Uri, lineNumber);++ /// <summary>+ /// Get the text for all lines.+ /// </summary>+ public ValueTask<List<string>> GetLinesContentAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<List<string>>("devtoys.MonacoEditor.model.getLinesContent", Uri);++ /// <summary>+ /// Get the end of line sequence predominantly used in the text buffer.+ /// @return EOL char sequence (e.g.: '\n' or '\r\n').+ /// </summary>+ public ValueTask<string> GetEOLAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.model.getEOL", Uri);++ /// <summary>+ /// Get the end of line sequence predominantly used in the text buffer.+ /// </summary>+ public ValueTask<EndOfLineSequence> GetEndOfLineSequenceAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<EndOfLineSequence>("devtoys.MonacoEditor.model.getEndOfLineSequence", Uri);++ /// <summary>+ /// Get the minimum legal column for line at `lineNumber`+ /// </summary>+ public ValueTask<int> GetLineMinColumnAsync(IJSRuntime runtime, int lineNumber)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getLineMinColumn", Uri, lineNumber);++ /// <summary>+ /// Get the maximum legal column for line at `lineNumber`+ /// </summary>+ public ValueTask<int> GetLineMaxColumnAsync(IJSRuntime runtime, int lineNumber)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getLineMaxColumn", Uri, lineNumber);++ /// <summary>+ /// Returns the column before the first non whitespace character for line at `lineNumber`.+ /// Returns 0 if line is empty or contains only whitespace.+ /// </summary>+ public ValueTask<int> GetLineFirstNonWhitespaceColumnAsync(IJSRuntime runtime, int lineNumber)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getLineFirstNonWhitespaceColumn", Uri, lineNumber);++ /// <summary>+ /// Returns the column after the last non whitespace character for line at `lineNumber`.+ /// Returns 0 if line is empty or contains only whitespace.+ /// </summary>+ public ValueTask<int> GetLineLastNonWhitespaceColumnAsync(IJSRuntime runtime, int lineNumber)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getLineLastNonWhitespaceColumn", Uri, lineNumber);++ /// <summary>+ /// Create a valid position.+ /// </summary>+ public ValueTask<Position> ValidatePositionAsync(IJSRuntime runtime, Position position)+ => runtime.InvokeAsync<Position>("devtoys.MonacoEditor.model.validatePosition", Uri, position);++ /// <summary>+ /// Advances the given position by the given offset (negative offsets are also accepted)+ /// and returns it as a new valid position.+ ///+ /// If the offset and position are such that their combination goes beyond the beginning or+ /// end of the model, throws an exception.+ ///+ /// If the offset is such that the new position would be in the middle of a multi-byte+ /// line terminator, throws an exception.+ /// </summary>+ public ValueTask<Position> ModifyPositionAsync(IJSRuntime runtime, Position position, int offset)+ => runtime.InvokeAsync<Position>("devtoys.MonacoEditor.model.modifyPosition", Uri, position, offset);++ /// <summary>+ /// Create a valid range.+ /// </summary>+ public ValueTask<Range> ValidateRangeAsync(IJSRuntime runtime, Range range)+ => runtime.InvokeAsync<Range>("devtoys.MonacoEditor.model.validateRange", Uri, range);++ /// <summary>+ /// Converts the position to a zero-based offset.+ ///+ /// The position will be [adjusted](#TextDocument.validatePosition).+ ///+ /// @param position A position.+ /// @return A valid zero-based offset.+ /// </summary>+ public ValueTask<int> GetOffsetAtAsync(IJSRuntime runtime, Position position)+ => runtime.InvokeAsync<int>("devtoys.MonacoEditor.model.getOffsetAt", Uri, position);++ /// <summary>+ /// Converts a zero-based offset to a position.+ ///+ /// @param offset A zero-based offset.+ /// @return A valid [position](#Position).+ /// </summary>+ public ValueTask<Position> GetPositionAtAsync(IJSRuntime runtime, int offset)+ => runtime.InvokeAsync<Position>("devtoys.MonacoEditor.model.getPositionAt", Uri, offset);++ /// <summary>+ /// Get a range covering the entire model.+ /// </summary>+ public ValueTask<Range> GetFullModelRangeAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<Range>("devtoys.MonacoEditor.model.getFullModelRange", Uri);++ /// <summary>+ /// Returns if the model was disposed or not.+ /// </summary>+ public ValueTask<bool> IsDisposedAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<bool>("devtoys.MonacoEditor.model.isDisposed", Uri);++ /// <summary>+ /// Search the model.+ /// @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.+ /// @param searchOnlyEditableRange Limit the searching to only search inside the editable range of the model.+ /// @param isRegex Used to indicate that `searchString` is a regular expression.+ /// @param matchCase Force the matching to match lower/upper case exactly.+ /// @param wordSeparators Force the matching to match entire words only. Pass null otherwise.+ /// @param captureMatches The result will contain the captured groups.+ /// @param limitResultCount Limit the number of results+ /// @return The ranges where the matches are. It is empty if not matches have been found.+ /// </summary>+ public ValueTask<List<FindMatch>> FindMatchesAsync(IJSRuntime runtime, string searchString, bool searchOnlyEditableRange, bool isRegex, bool matchCase, string wordSeparators, bool captureMatches, int? limitResultCount)+ => runtime.InvokeAsync<List<FindMatch>>("devtoys.MonacoEditor.model.findMatches", Uri, searchString, searchOnlyEditableRange, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount);++ /// <summary>+ /// Search the model.+ /// @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.+ /// @param searchScope Limit the searching to only search inside these ranges.+ /// @param isRegex Used to indicate that `searchString` is a regular expression.+ /// @param matchCase Force the matching to match lower/upper case exactly.+ /// @param wordSeparators Force the matching to match entire words only. Pass null otherwise.+ /// @param captureMatches The result will contain the captured groups.+ /// @param limitResultCount Limit the number of results+ /// @return The ranges where the matches are. It is empty if no matches have been found.+ /// </summary>+ public ValueTask<List<FindMatch>> FindMatchesAsync(IJSRuntime runtime, string searchString, Range searchScope, bool isRegex, bool matchCase, string wordSeparators, bool captureMatches, int? limitResultCount)+ => runtime.InvokeAsync<List<FindMatch>>("devtoys.MonacoEditor.model.findMatches", Uri, searchString, searchScope, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount);++ /// <summary>+ /// Search the model for the next match. Loops to the beginning of the model if needed.+ /// @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.+ /// @param searchStart Start the searching at the specified position.+ /// @param isRegex Used to indicate that `searchString` is a regular expression.+ /// @param matchCase Force the matching to match lower/upper case exactly.+ /// @param wordSeparators Force the matching to match entire words only. Pass null otherwise.+ /// @param captureMatches The result will contain the captured groups.+ /// @return The range where the next match is. It is null if no next match has been found.+ /// </summary>+ public ValueTask<FindMatch> FindNextMatchAsync(IJSRuntime runtime, string searchString, Position searchStart, bool isRegex, bool matchCase, string wordSeparators, bool captureMatches)+ => runtime.InvokeAsync<FindMatch>("devtoys.MonacoEditor.model.findNextMatch", Uri, searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches);++ /// <summary>+ /// Search the model for the previous match. Loops to the end of the model if needed.+ /// @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.+ /// @param searchStart Start the searching at the specified position.+ /// @param isRegex Used to indicate that `searchString` is a regular expression.+ /// @param matchCase Force the matching to match lower/upper case exactly.+ /// @param wordSeparators Force the matching to match entire words only. Pass null otherwise.+ /// @param captureMatches The result will contain the captured groups.+ /// @return The range where the previous match is. It is null if no previous match has been found.+ /// </summary>+ public ValueTask<FindMatch> FindPreviousMatchAsync(IJSRuntime runtime, string searchString, Position searchStart, bool isRegex, bool matchCase, string wordSeparators, bool captureMatches)+ => runtime.InvokeAsync<FindMatch>("devtoys.MonacoEditor.model.findPreviousMatch", Uri, searchString, searchStart, isRegex, matchCase, wordSeparators, captureMatches);++ /// <summary>+ /// Get the language associated with this model.+ /// </summary>+ public ValueTask<string> GetLanguageIdAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.model.getLanguageId", Uri);++ /// <summary>+ /// Get the word under or besides `position`.+ /// @param position The position to look for a word.+ /// @return The word under or besides `position`. Might be null.+ /// </summary>+ public ValueTask<WordAtPosition> GetWordAtPositionAsync(IJSRuntime runtime, Position position)+ => runtime.InvokeAsync<WordAtPosition>("devtoys.MonacoEditor.model.getWordAtPosition", Uri, position);++ /// <summary>+ /// Get the word under or besides `position` trimmed to `position`.column+ /// @param position The position to look for a word.+ /// @return The word under or besides `position`. Will never be null.+ /// </summary>+ public ValueTask<WordAtPosition> GetWordUntilPositionAsync(IJSRuntime runtime, Position position)+ => runtime.InvokeAsync<WordAtPosition>("devtoys.MonacoEditor.model.getWordUntilPosition", Uri, position);++ /// <summary>+ /// Perform a minimum amount of operations, in order to transform the decorations+ /// identified by `oldDecorations` to the decorations described by `newDecorations`+ /// and returns the new identifiers associated with the resulting decorations.+ ///+ /// @param oldDecorations Array containing previous decorations identifiers.+ /// @param newDecorations Array describing what decorations should result after the call.+ /// @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model.+ /// @return An array containing the new decorations identifiers.+ /// </summary>+ public ValueTask<List<string>> DeltaDecorationsAsync(IJSRuntime runtime, List<string> oldDecorations, List<ModelDeltaDecoration> newDecorations, int? ownerId)+ => runtime.InvokeAsync<List<string>>("devtoys.MonacoEditor.model.deltaDecorations", Uri, oldDecorations, newDecorations, ownerId);++ /// <summary>+ /// Get the options associated with a decoration.+ /// @param id The decoration id.+ /// @return The decoration options or null if the decoration was not found.+ /// </summary>+ public ValueTask<ModelDecorationOptions> GetDecorationOptionsAsync(IJSRuntime runtime, string id)+ => runtime.InvokeAsync<ModelDecorationOptions>("devtoys.MonacoEditor.model.getDecorationOptions", Uri, id);++ /// <summary>+ /// Get the range associated with a decoration.+ /// @param id The decoration id.+ /// @return The decoration range or null if the decoration was not found.+ /// </summary>+ public ValueTask<Range> GetDecorationRangeAsync(IJSRuntime runtime, string id)+ => runtime.InvokeAsync<Range>("devtoys.MonacoEditor.model.getDecorationRange", Uri, id);++ /// <summary>+ /// Gets all the decorations for the line `lineNumber` as an array.+ /// @param lineNumber The line number+ /// @param ownerId If set, it will ignore decorations belonging to other owners.+ /// @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).+ /// @return An array with the decorations+ /// </summary>+ public ValueTask<ModelDecoration> GetLineDecorationsAsync(IJSRuntime runtime, int lineNumber, int? ownerId, bool? filterOutValidation)+ => runtime.InvokeAsync<ModelDecoration>("devtoys.MonacoEditor.model.getLineDecorations", Uri, lineNumber, ownerId, filterOutValidation);++ /// <summary>+ /// Gets all the decorations for the lines between `startLineNumber` and `endLineNumber` as an array.+ /// @param startLineNumber The start line number+ /// @param endLineNumber The end line number+ /// @param ownerId If set, it will ignore decorations belonging to other owners.+ /// @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).+ /// @return An array with the decorations+ /// </summary>+ public ValueTask<ModelDecoration> GetLinesDecorationsAsync(IJSRuntime runtime, int startLineNumber, int endLineNumber, int? ownerId, bool? filterOutValidation)+ => runtime.InvokeAsync<ModelDecoration>("devtoys.MonacoEditor.model.getLinesDecorations", Uri, startLineNumber, endLineNumber, ownerId, filterOutValidation);++ /// <summary>+ /// Gets all the decorations in a range as an array. Only `startLineNumber` and `endLineNumber` from `range` are used for filtering.+ /// So for now it returns all the decorations on the same line as `range`.+ /// @param range The range to search in+ /// @param ownerId If set, it will ignore decorations belonging to other owners.+ /// @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).+ /// @return An array with the decorations+ /// </summary>+ public ValueTask<ModelDecoration[]> GetDecorationsInRangeAsync(IJSRuntime runtime, Range range, int? ownerId, bool? filterOutValidation)+ => runtime.InvokeAsync<ModelDecoration[]>("devtoys.MonacoEditor.model.getDecorationsInRange", Uri, range, ownerId, filterOutValidation);++ /// <summary>+ /// Gets all the decorations as an array.+ /// @param ownerId If set, it will ignore decorations belonging to other owners.+ /// @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).+ /// </summary>+ public ValueTask<List<ModelDecoration>> GetAllDecorationsAsync(IJSRuntime runtime, int? ownerId, bool? filterOutValidation)+ => runtime.InvokeAsync<List<ModelDecoration>>("devtoys.MonacoEditor.model.getAllDecorations", Uri, ownerId, filterOutValidation);++ /// <summary>+ /// Gets all the decorations that should be rendered in the overview ruler as an array.+ /// @param ownerId If set, it will ignore decorations belonging to other owners.+ /// @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).+ /// </summary>+ public ValueTask<ModelDecoration> GetOverviewRulerDecorationsAsync(IJSRuntime runtime, int? ownerId, bool? filterOutValidation)+ => runtime.InvokeAsync<ModelDecoration>("devtoys.MonacoEditor.model.getOverviewRulerDecorations", Uri, ownerId, filterOutValidation);++ /// <summary>+ /// Gets all the decorations that contain injected text.+ /// @param ownerId If set, it will ignore decorations belonging to other owners.+ /// </summary>+ public ValueTask<ModelDecoration[]> GetInjectedTextDecorationsAsync(IJSRuntime runtime, int? ownerId)+ => runtime.InvokeAsync<ModelDecoration[]>("devtoys.MonacoEditor.model.getInjectedTextDecorations", Uri, ownerId);++ /// <summary>+ /// Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).+ /// </summary>+ public ValueTask<string> NormalizeIndentationAsync(IJSRuntime runtime, string str)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.model.normalizeIndentation", Uri, str);++ /// <summary>+ /// Change the options of this model.+ /// </summary>+ public ValueTask<bool> UpdateOptionsAsync(IJSRuntime runtime, TextModelUpdateOptions newOptions)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.updateOptions", Uri, newOptions);++ /// <summary>+ /// Detect the indentation options for this model from its content.+ /// </summary>+ public ValueTask<bool> DetectIndentationAsync(IJSRuntime runtime, bool defaultInsertSpaces, int defaultTabSize)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.detectIndentation", Uri, defaultInsertSpaces, defaultTabSize);++ /// <summary>+ /// Close the current undo-redo element.+ /// This offers a way to create an undo/redo stop point.+ /// </summary>+ public ValueTask<bool> PushStackElementAsync(IJSRuntime runtime)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.pushStackElement", Uri);++ /// <summary>+ /// Open the current undo-redo element.+ /// This offers a way to remove the current undo/redo stop point.+ /// </summary>+ public ValueTask<bool> PopStackElementAsync(IJSRuntime runtime)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.popStackElement", Uri);++ /// <summary>+ /// Change the end of line sequence. This is the preferred way of+ /// changing the eol sequence. This will land on the undo stack.+ /// </summary>+ public ValueTask<bool> PushEOLAsync(IJSRuntime runtime, EndOfLineSequence eol)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.pushEOL", Uri, eol);++ /// <summary>+ /// Edit the model without adding the edits to the undo stack.+ /// This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way.+ /// @param operations The edit operations.+ /// @return If desired, the inverse edit operations, that, when applied, will bring the model back to the previous state.+ /// </summary>+ public ValueTask<List<ValidEditOperation>> ApplyEditsAsync(IJSRuntime runtime, List<IdentifiedSingleEditOperation> operations, bool computeUndoEdits = false)+ => runtime.InvokeAsync<List<ValidEditOperation>>("devtoys.MonacoEditor.model.applyEdits", Uri, operations, computeUndoEdits);++ /// <summary>+ /// Change the end of line sequence without recording in the undo stack.+ /// This can have dire consequences on the undo stack! See @pushEOL for the preferred way.+ /// </summary>+ public ValueTask<bool> SetEOLAsync(IJSRuntime runtime, EndOfLineSequence eol)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.setEOL", Uri, eol);++ /// <summary>+ /// Destroy this model.+ /// </summary>+ public ValueTask<bool> DisposeModelAsync(IJSRuntime runtime)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.model.dispose", Uri);+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Token.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Token.csnew file mode 100644index 000000000..0f59a563b--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/Token.cs@@ -0,0 +1,14 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class Token+{+ public int Offset { get; set; }++ public string? Type { get; set; }++ public string? Language { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/UriComponents.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/UriComponents.csnew file mode 100644index 000000000..c48ae90f1--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/Monaco/UriComponents.cs@@ -0,0 +1,18 @@+///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components.Monaco;++public class UriComponents+{+ public string? Scheme { get; set; }++ public string? Authority { get; set; }++ public string? Path { get; set; }++ public string? Query { get; set; }++ public string? Fragment { get; set; }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razornew file mode 100644index 000000000..93109c4e7--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor@@ -0,0 +1,27 @@+@namespace DevToys.Blazor.Components+@inherits RicherMonacoEditorBase++<CascadingValue Value="this" IsFixed="true">+ <div id="@(Id)-monaco-container"+ class="monaco-editor-standalone-with-header @(FinalCssClasses)"+ style="@(Style)"+ @attributes="AdditionalAttributes">++ @if (!string.IsNullOrWhiteSpace(Header))+ {+ <TextBlock Appearance="TextBlockAppearance.Body" Class="monaco-editor-standalone-header" Text="@Header" />+ }++ <div class="monaco-editor-standalone-container @(IsEnabled ? string.Empty : "disabled")"+ @ref=Element>++ <ProgressRing id="@($"{Id}-loading")"+ IsIndeterminate="@ShowLoading"+ Style="@((ShowLoading ? string.Empty : "display: none;"))"/>++ <div id="@Id" class="monaco-editor-standalone-instance"></div>++ <div class="monaco-editor-standalone-underline" />+ </div>+ </div>+</CascadingValue>\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor.csnew file mode 100644index 000000000..e114409d9--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor.cs@@ -0,0 +1,135 @@+using System.Text.Json;+using System.Text.Json.Serialization;+using DevToys.Api;+using DevToys.Blazor.Components.Monaco.Editor;++namespace DevToys.Blazor.Components;++public partial class MonacoEditor : RicherMonacoEditorBase+{+ private readonly object _lock = new object();+ private bool _isLoaded;++ [Import]+ internal IThemeListener ThemeListener { get; set; } = default!;++ [Parameter]+ public string? Header { get; set; }++ [Parameter]+ public Func<MonacoEditor, StandaloneEditorConstructionOptions>? ConstructionOptions { get; set; }++ private bool ShowLoading { get; set; }++ protected override void OnInitialized()+ {+ base.OnInitialized();++ ThemeListener.ThemeChanged += ThemeListener_ThemeChanged;+ }++ protected override async Task OnAfterRenderAsync(bool firstRender)+ {+ if (firstRender)+ {+ InvokeAsync(DisplayLoadingIfSlowLoadingAsync).Forget();++ // Get desired options+ StandaloneEditorConstructionOptions options = ConstructionOptions?.Invoke(this) ?? new();++ // Overwrite some important options.+ options.Theme = GetTheme();+ options.AutomaticLayout = true;+ options.GlyphMargin = false;+ options.MouseWheelZoom = false;+ options.OverviewRulerBorder = false;+ options.ScrollBeyondLastLine = false;+ options.FontLigatures = true;+ options.SnippetSuggestions = "none";+ options.CodeLens = false;+ options.QuickSuggestions = new QuickSuggestionsOptions { Comments = false, Other = false, Strings = false } ;+ options.WordBasedSuggestions = false;+ options.Minimap = new EditorMinimapOptions { Enabled = false };+ options.Hover = new EditorHoverOptions { Enabled = false };+ options.MatchBrackets = "always";+ options.BracketPairColorization = new BracketPairColorizationOptions { Enabled = true };++ options.Language = "json";++ // Create the editor+ await MonacoEditorHelper.CreateMonacoEditorInstanceAsync(JSRuntime, Id, options, null, Reference);+ }++ await base.OnAfterRenderAsync(firstRender);+ }++ public override ValueTask DisposeAsync()+ {+ if (ThemeListener is not null)+ {+ ThemeListener.ThemeChanged -= ThemeListener_ThemeChanged;+ }++ return base.DisposeAsync();+ }++ internal ValueTask<bool> UpdateOptionsAsync(EditorUpdateOptions newOptions)+ {+ // Convert the options object into a JsonElement to get rid of the properties with null values+ string optionsJson = JsonSerializer.Serialize(newOptions, new JsonSerializerOptions+ {+ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase+ });+ JsonElement optionsDict = JsonSerializer.Deserialize<JsonElement>(optionsJson);+ return JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.updateOptions", Id, optionsDict);+ }++ protected override void OnEditorLoaded()+ {+ base.OnEditorLoaded();+ lock (_lock)+ {+ _isLoaded = true;+ ShowLoading = false;+ StateHasChanged();+ }+ }++ private void ThemeListener_ThemeChanged(object? sender, EventArgs e)+ {+ var options = new EditorUpdateOptions()+ {+ Theme = GetTheme()+ };++ UpdateOptionsAsync(options);+ }++ private string GetTheme()+ {+ Guard.IsNotNull(ThemeListener);+ return ThemeListener.ActualAppTheme == ApplicationTheme.Dark ? BuiltinTheme.VsDark : BuiltinTheme.Vs;+ }++ private async Task DisplayLoadingIfSlowLoadingAsync()+ {+ // Let's not show the progress ring during the first 100ms. We know customers tends to perceive anything+ // faster than 100ms as "instant", so no need to bother the user with a very shortly displayed progress ring+ // if we succeed to load within 100ms.+ // https://psychology.stackexchange.com/questions/1664/what-is-the-threshold-where-actions-are-perceived-as-instant++ const int delay = 100;++ await Task.Delay(delay);++ lock (_lock)+ {+ if (!_isLoaded)+ {+ ShowLoading = true;+ StateHasChanged();+ }+ }+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor.scss b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor.scssnew file mode 100644index 000000000..9e7b30769--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditor.razor.scss@@ -0,0 +1,91 @@+@use "../../Assets/sass/devtoys" as *;++.monaco-editor-standalone {+ @include typography-body;+ box-sizing: border-box;+ border: none;+ outline: none;+ cursor: unset;+ margin: 0;+ inline-size: 100%;+ min-block-size: 30px;+ padding-inline: 10px;+ border-radius: var(--control-corner-radius);+ color: var(--text-box-foreground);+ background-color: transparent;++ &.disabled {+ color: var(--text-fill-color-disabled);+ }++ &-instance {+ min-height: 100px;+ }++ &-with-header {+ display: block;+ position: relative;++ .monaco-editor-standalone-header {+ margin-bottom: 4px;+ }+ }++ &-container {+ cursor: text;+ position: relative;+ border-radius: var(--control-corner-radius);+ background-clip: padding-box;+ background-color: var(--text-box-background);+ border: 1px solid var(--text-box-border);++ &:hover {+ color: var(--text-box-foreground-pointer-over);+ background-color: var(--text-box-background-pointer-over);+ border-color: var(--text-box-border-pointer-over);+ }++ &.disabled {+ cursor: default;+ color: var(--text-box-foreground-disabled);+ background-color: var(--text-box-background-disabled);+ border-color: var(--text-box-border-disabled);++ .monaco-editor-standalone-underline {+ display: none;+ }+ }++ &:focus-within {+ color: var(--text-box-foreground-focused);+ background-color: var(--text-box-background-focused);+ border-color: var(--text-box-border-focused);++ .monaco-editor-standalone-underline::after {+ border-bottom: 2px solid var(--accent-default);+ }+ }+ }++ &-underline {+ position: absolute;+ inset-inline-start: -1px;+ inset-block-start: -1px;+ inline-size: calc(100% + 2px);+ block-size: calc(100% + 2px);+ pointer-events: none;+ border-radius: var(--control-corner-radius);+ overflow: hidden;++ &::after {+ content: "";+ box-sizing: border-box;+ position: absolute;+ inset-block-end: 0;+ inset-inline-start: 0;+ inline-size: 100%;+ block-size: 100%;+ border-bottom: 1px solid var(--control-strong-stroke-default);+ }+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditorBase.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditorBase.csnew file mode 100644index 000000000..6a4aaf608--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditorBase.cs@@ -0,0 +1,297 @@+using System.Text.Json;+using DevToys.Blazor.Components.Monaco;+using DevToys.Blazor.Components.Monaco.Editor;++namespace DevToys.Blazor.Components;++public abstract class MonacoEditorBase : MefComponentBase+{+ private static readonly object themeDefinedLock = new();+ private static bool isThemeDefined;++ [Parameter]+ public EventCallback OnDidDispose { get; set; }++ [Parameter]+ public EventCallback OnDidInit { get; set; }++ protected override Task OnInitializedAsync()+ {+ lock (themeDefinedLock)+ {+ if (!isThemeDefined)+ {+ isThemeDefined = true;+ MonacoEditorHelper.DefineThemeAsync(+ JSRuntime,+ "vs-dark",+ new StandaloneThemeData+ {+ Base = "vs-dark",+ Inherit = true,+ Rules = new(),+ Colors = new Dictionary<string, string>+ {+ { "foreground", "#FFFFFF" },+ { "editor.foreground", "#FFFFFF" },+ { "editor.background", "#00000000" },+ { "editor.lineHighlightBackground", "#FFFFFF19" },+ //{ "editorLineNumber.foreground", "#EEEEEE99" },+ //{ "editorLineNumber.activeForeground", "#EEEEEE99" },+ { "editor.inactiveSelectionBackground", "#00000000" },+ { "editor.selectionForeground", "#FFFFFF" },+ { "editor.selectionBackground", "#0079D6" },+ { "editorWidget.background", "#252526" }+ }+ });+ MonacoEditorHelper.DefineThemeAsync(+ JSRuntime,+ "vs",+ new StandaloneThemeData+ {+ Base = "vs",+ Inherit = true,+ Rules = new(),+ Colors = new Dictionary<string, string>+ {+ { "foreground", "#000000" },+ { "editor.foreground", "#000000" },+ { "editor.background", "#FFFFFF00" },+ { "editor.lineHighlightBackground", "#00000019" },+ //{ "editorLineNumber.foreground", "#00000099" },+ //{ "editorLineNumber.activeForeground", "#00000099" },+ { "editor.inactiveSelectionBackground", "#00000000" },+ { "editor.selectionForeground", "#000000" },+ { "editor.selectionBackground", "#0079D6" }, // may need to change?+ { "editorWidget.background", "#F3F3F3" }+ }+ });+ }+ }++ return base.OnInitializedAsync();+ }++ protected override async Task OnAfterRenderAsync(bool firstRender)+ {+ if (firstRender)+ {+ await SetEventListenersAsync();+ OnEditorLoaded();+ await OnDidInit.InvokeAsync(this);+ }++ await base.OnAfterRenderAsync(firstRender);+ }++ protected virtual async Task SetEventListenersAsync()+ {+ if (OnDidDispose.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidDispose));+ }+ }++ protected virtual void OnEditorLoaded()+ {+ }++ public virtual async Task EventCallbackAsync(string eventName, string eventJson)+ {+ switch (eventName)+ {+ case nameof(OnDidDispose): await OnDidDispose.InvokeAsync(this); break;+ }+ }++ protected ValueTask<bool> SetEventListenerAsync(string eventName)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setEventListener", Id, eventName);++ public override async ValueTask DisposeAsync()+ {+ try+ {+ await JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.dispose", Id);+ }+ catch+ {+ // ignore.+ }+ await base.DisposeAsync();+ }++ /// <summary>+ /// Get the editor type. Please see `EditorType`.+ /// This is to avoid an instanceof check+ /// </summary>+ internal ValueTask<string> GetEditorTypeAsync()+ => JSRuntime.InvokeAsync<string>("devtoys.MonacoEditor.getEditorType", Id);++ /// <summary>+ /// Instructs the editor to remeasure its container. This method should+ /// be called when the container of the editor gets resized.+ ///+ /// If a dimension is passed in, the passed in value will be used.+ /// </summary>+ internal ValueTask<string> LayoutAsync(Dimension? dimension = null)+ => JSRuntime.InvokeAsync<string>("devtoys.MonacoEditor.layout", Id, dimension);++ /// <summary>+ /// Brings browser focus to the editor text+ /// </summary>+ internal ValueTask<bool> FocusAsync()+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.focus", Id);++ /// <summary>+ /// Returns true if the text inside this editor is focused (i.e. cursor is blinking).+ /// </summary>+ internal ValueTask<bool> HasTextFocusAsync()+ => JSRuntime.InvokeAsync<bool>("devtoys.MonacoEditor.hasTextFocus", Id);++ /// <summary>+ /// Given a position, returns a column number that takes tab-widths into account.+ /// </summary>+ internal ValueTask<int> GetVisibleColumnFromPositionAsync(Position position)+ => JSRuntime.InvokeAsync<int>("devtoys.MonacoEditor.getVisibleColumnFromPosition", Id, position);++ /// <summary>+ /// Returns the primary position of the cursor.+ /// </summary>+ internal ValueTask<Position> GetPositionAsync()+ => JSRuntime.InvokeAsync<Position>("devtoys.MonacoEditor.getPosition", Id);++ /// <summary>+ /// Set the primary position of the cursor. This will remove any secondary cursors.+ /// @param position New primary cursor's position+ /// @param source Source of the call that caused the position+ /// </summary>+ internal ValueTask<bool> SetPositionAsync(Position position, string source)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setPosition", Id, position, source);++ /// <summary>+ /// Scroll vertically as necessary and reveal a line.+ /// </summary>+ internal ValueTask<bool> RevealLineAsync(int lineNumber, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealLine", Id, lineNumber, scrollType);++ /// <summary>+ /// Scroll vertically as necessary and reveal a line centered vertically.+ /// </summary>+ internal ValueTask<bool> RevealLineInCenterAsync(int lineNumber, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealLineInCenter", Id, lineNumber, scrollType);++ /// <summary>+ /// Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.+ /// </summary>+ internal ValueTask<bool> RevealLineInCenterIfOutsideViewportAsync(int lineNumber, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealLineInCenterIfOutsideViewport", Id, lineNumber, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a position.+ /// </summary>+ internal ValueTask<bool> RevealPositionAsync(Position position, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealPosition", Id, position, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a position centered vertically.+ /// </summary>+ internal ValueTask<bool> RevealPositionInCenterAsync(Position position, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealPositionInCenter", Id, position, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.+ /// </summary>+ internal ValueTask<bool> RevealPositionInCenterIfOutsideViewportAsync(Position position, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealPositionInCenterIfOutsideViewport", Id, position, scrollType);++ /// <summary>+ /// Returns the primary selection of the editor.+ /// </summary>+ internal ValueTask<Selection> GetSelectionAsync()+ => JSRuntime.InvokeAsync<Selection>("devtoys.MonacoEditor.getSelection", Id);++ /// <summary>+ /// Returns all the selections of the editor.+ /// </summary>+ internal ValueTask<List<Selection>> GetSelectionsAsync()+ => JSRuntime.InvokeAsync<List<Selection>>("devtoys.MonacoEditor.getSelections", Id);++ /// <summary>+ /// Set the primary selection of the editor. This will remove any secondary cursors.+ /// @param selection The new selection+ /// @param source Source of the call that caused the selection+ /// </summary>+ internal ValueTask<bool> SetSelectionAsync(Monaco.Range selection, string source)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setSelection", Id, selection, source);++ /// <summary>+ /// Set the primary selection of the editor. This will remove any secondary cursors.+ /// @param selection The new selection+ /// @param source Source of the call that caused the selection+ /// </summary>+ internal ValueTask<bool> SetSelectionAsync(Selection selection, string source)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setSelection", Id, selection, source);++ /// <summary>+ /// Set the selections for all the cursors of the editor.+ /// Cursors will be removed or added, as necessary.+ /// @param selections The new selection+ /// @param source Source of the call that caused the selection+ /// </summary>+ internal ValueTask<bool> SetSelectionsAsync(List<Selection> selections, string source)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setSelections", Id, selections, source);++ /// <summary>+ /// Scroll vertically as necessary and reveal lines.+ /// </summary>+ internal ValueTask<bool> RevealLinesAsync(int startLineNumber, int endLineNumber, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealLines", Id, startLineNumber, endLineNumber, scrollType);++ /// <summary>+ /// Scroll vertically as necessary and reveal lines centered vertically.+ /// </summary>+ internal ValueTask<bool> RevealLinesInCenterAsync(int lineNumber, int endLineNumber, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealLinesInCenter", Id, lineNumber, endLineNumber, scrollType);++ /// <summary>+ /// Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.+ /// </summary>+ internal ValueTask<bool> RevealLinesInCenterIfOutsideViewportAsync(int lineNumber, int endLineNumber, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealLinesInCenterIfOutsideViewport", Id, lineNumber, endLineNumber, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a range.+ /// </summary>+ internal ValueTask<bool> RevealRangeAsync(Monaco.Range range, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealRange", Id, range, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a range centered vertically.+ /// </summary>+ internal ValueTask<bool> RevealRangeInCenterAsync(Monaco.Range range, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealRangeInCenter", Id, range, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.+ /// </summary>+ internal ValueTask<bool> RevealRangeAtTopAsync(Monaco.Range range, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealRangeAtTop", Id, range, scrollType);++ /// <summary>+ /// Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.+ /// </summary>+ internal ValueTask<bool> RevealRangeInCenterIfOutsideViewportAsync(Monaco.Range range, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.revealRangeInCenterIfOutsideViewport", Id, range, scrollType);++ /// <summary>+ /// Directly trigger a handler or an editor action.+ /// @param source The source of the call.+ /// @param handlerId The id of the handler or the id of a contribution.+ /// @param payload Extra data to be sent to the handler.+ /// </summary>+ internal ValueTask<bool> TriggerAsync(string source, string handlerId, object? payload = null)+ {+ JsonElement payloadJsonElement = JsonSerializer.Deserialize<JsonElement>(JsonSerializer.Serialize(payload));+ return JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.trigger", Id, source, handlerId, payloadJsonElement);+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditorHelper.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditorHelper.csnew file mode 100644index 000000000..1cc15306f--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/MonacoEditorHelper.cs@@ -0,0 +1,148 @@+using System.Text.Json;+using System.Text.Json.Serialization;+using DevToys.Blazor.Components.Monaco;+using DevToys.Blazor.Components.Monaco.Editor;++///-------------------------------------------------------------------------------------------------------------+/// C# translation of the https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts file+///-------------------------------------------------------------------------------------------------------------++namespace DevToys.Blazor.Components;++internal static class MonacoEditorHelper+{+ /// <summary>+ /// Create a new editor under `domElement`.+ /// `domElement` should be empty (not contain other dom nodes).+ /// The editor will read the size of `domElement`.+ /// </summary>+ internal static async ValueTask<MonacoEditor?> CreateMonacoEditorInstanceAsync(+ IJSRuntime runtime,+ string domElementId,+ StandaloneEditorConstructionOptions options,+ EditorOverrideServices? overrideServices,+ DotNetObjectReference<JSStyledComponentBase> dotnetObjectRef)+ {+ Guard.IsNotNull(runtime);+ Guard.IsNotNullOrWhiteSpace(domElementId);+ Guard.IsNotNull(options);+ Guard.IsNotNull(dotnetObjectRef);++ // Convert the options object into a JsonElement to get rid of the properties with null values+ string optionsJson = JsonSerializer.Serialize(options, new JsonSerializerOptions+ {+ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase+ });+ JsonElement optionsDict = JsonSerializer.Deserialize<JsonElement>(optionsJson);++ // Create the editor+ await runtime.InvokeVoidAsync(+ "devtoys.MonacoEditor.create",+ domElementId,+ optionsDict,+ overrideServices,+ dotnetObjectRef);++ return dotnetObjectRef.Value as MonacoEditor;+ }+++ /// <summary>+ /// Create a new diff editor under `domElement`.+ /// `domElement` should be empty (not contain other dom nodes).+ /// The editor will read the size of `domElement`.+ /// </summary>+ //internal static async ValueTask<DiffMonacoEditor?> CreateDiffEditorAsync(+ // IJSRuntime runtime,+ // string domElementId,+ // StandaloneDiffEditorConstructionOptions options,+ // EditorOverrideServices overrideServices,+ // DotNetObjectReference<JSStyledComponentBase> dotnetObjectRef,+ // DotNetObjectReference<JSStyledComponentBase> dotnetObjectRefOriginal,+ // DotNetObjectReference<JSStyledComponentBase> dotnetObjectRefModified)+ //{+ // options ??= new StandaloneDiffEditorConstructionOptions();++ // // Convert the options object into a JsonElement to get rid of the properties with null values+ // string optionsJson = JsonSerializer.Serialize(options, new JsonSerializerOptions+ // {+ // DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,+ // PropertyNamingPolicy = JsonNamingPolicy.CamelCase+ // });+ // JsonElement optionsDict = JsonSerializer.Deserialize<JsonElement>(optionsJson);++ // // Create the editor+ // await runtime.InvokeVoidAsync(+ // "devtoys.MonacoEditor.createDiffEditor",+ // domElementId,+ // optionsDict,+ // overrideServices,+ // dotnetObjectRef,+ // dotnetObjectRefOriginal,+ // dotnetObjectRefModified);++ // return dotnetObjectRef.Value as DiffMonacoEditor;+ //}++ /// <summary>+ /// Create a new editor model.+ /// You can specify the language that should be set for this model or let the language be inferred from the `uri`.+ /// </summary>+ internal static ValueTask<TextModel> CreateModelAsync(IJSRuntime runtime, string value, string? language = null, string? uri = null)+ => runtime.InvokeAsync<TextModel>("devtoys.MonacoEditor.createModel", value, language, uri);++ /// <summary>+ /// Change the language for a model.+ /// </summary>+ internal static ValueTask<bool> SetModelLanguageAsync(IJSRuntime runtime, TextModel model, string languageId)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setModelLanguage", model.Uri, languageId);++ /// <summary>+ /// Get the model that has `uri` if it exists.+ /// </summary>+ internal static ValueTask<TextModel> GetModelAsync(IJSRuntime runtime, string uri)+ => runtime.InvokeAsync<TextModel>("devtoys.MonacoEditor.getModel", uri);++ /// <summary>+ /// Get all the created models.+ /// </summary>+ internal static ValueTask<List<TextModel>> GetModelsAsync(IJSRuntime runtime)+ => runtime.InvokeAsync<List<TextModel>>("devtoys.MonacoEditor.getModels");++ /// <summary>+ /// Colorize the contents of `domNode` using attribute `data-lang`.+ /// </summary>+ internal static ValueTask<bool> ColorizeElementAsync(IJSRuntime runtime, string domNodeId, ColorizerElementOptions options)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.colorizeElement", domNodeId, options);++ /// <summary>+ /// Colorize `text` using language `languageId`.+ /// </summary>+ internal static ValueTask<string> ColorizeAsync(IJSRuntime runtime, string text, string languageId, ColorizerOptions options)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.colorize", text, languageId, options);++ /// <summary>+ /// Colorize a line in a model.+ /// </summary>+ internal static ValueTask<string> ColorizeModelLineAsync(IJSRuntime runtime, TextModel model, int lineNumber, int? tabSize = null)+ => runtime.InvokeAsync<string>("devtoys.MonacoEditor.colorizeModelLine", model.Uri, lineNumber, tabSize);++ /// <summary>+ /// Define a new theme or update an existing theme.+ /// </summary>+ internal static ValueTask<bool> DefineThemeAsync(IJSRuntime runtime, string themeName, StandaloneThemeData themeData)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.defineTheme", themeName, themeData);++ /// <summary>+ /// Switches to a theme.+ /// </summary>+ internal static ValueTask<bool> SetThemeAsync(IJSRuntime runtime, string themeName)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setTheme", themeName);++ /// <summary>+ /// Clears all cached font measurements and triggers re-measurement.+ /// </summary>+ internal static ValueTask<bool> RemeasureFontsAsync(IJSRuntime runtime)+ => runtime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.remeasureFonts");+}diff --git a/src/app/dev/DevToys.Blazor/Components/MonacoEditor/RicherMonacoEditorBase.cs b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/RicherMonacoEditorBase.csnew file mode 100644index 000000000..4cbc1e615--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/MonacoEditor/RicherMonacoEditorBase.cs@@ -0,0 +1,696 @@+using System.Text.Json;+using System.Text.Json.Serialization;+using DevToys.Blazor.Components.Monaco;+using DevToys.Blazor.Components.Monaco.Editor;++namespace DevToys.Blazor.Components;++public abstract class RicherMonacoEditorBase : MonacoEditorBase+{+ private readonly List<string> _deltaDecorationIds = new();+ private CursorStateComputer? _executeEditsLambda;++ /// <summary>+ /// An event emitted when the content of the current model has changed.+ /// </summary>+ [Parameter]+ public EventCallback<ModelContentChangedEvent> OnDidChangeModelContent { get; set; }++ /// <summary>+ /// An event emitted when the language of the current model has changed.+ /// </summary>+ [Parameter]+ public EventCallback<ModelLanguageChangedEvent> OnDidChangeModelLanguage { get; set; }++ /// <summary>+ /// An event emitted when the language configuration of the current model has changed.+ /// </summary>+ [Parameter]+ public EventCallback<ModelLanguageConfigurationChangedEvent> OnDidChangeModelLanguageConfiguration { get; set; }++ /// <summary>+ /// An event emitted when the options of the current model has changed.+ /// </summary>+ [Parameter]+ public EventCallback<ModelOptionsChangedEvent> OnDidChangeModelOptions { get; set; }++ /// <summary>+ /// An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`)+ /// </summary>+ [Parameter]+ public EventCallback<ConfigurationChangedEvent> OnDidChangeConfiguration { get; set; }++ /// <summary>+ /// An event emitted when the cursor position has changed.+ /// </summary>+ [Parameter]+ public EventCallback<CursorPositionChangedEvent> OnDidChangeCursorPosition { get; set; }++ /// <summary>+ /// An event emitted when the cursor selection has changed.+ /// </summary>+ [Parameter]+ public EventCallback<CursorSelectionChangedEvent> OnDidChangeCursorSelection { get; set; }++ /// <summary>+ /// An event emitted when the model of this editor has changed (e.g. `editor.setModel()`).+ /// </summary>+ [Parameter]+ public EventCallback<ModelChangedEvent> OnDidChangeModel { get; set; }++ /// <summary>+ /// An event emitted when the decorations of the current model have changed.+ /// </summary>+ [Parameter]+ public EventCallback<ModelDecorationsChangedEvent> OnDidChangeModelDecorations { get; set; }++ /// <summary>+ /// An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).+ /// </summary>+ [Parameter]+ public EventCallback OnDidFocusEditorText { get; set; }++ /// <summary>+ /// An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).+ /// </summary>+ [Parameter]+ public EventCallback OnDidBlurEditorText { get; set; }++ /// <summary>+ /// An event emitted when the text inside this editor or an editor widget gained focus.+ /// </summary>+ [Parameter]+ public EventCallback OnDidFocusEditorWidget { get; set; }++ /// <summary>+ /// An event emitted when the text inside this editor or an editor widget lost focus.+ /// </summary>+ [Parameter]+ public EventCallback OnDidBlurEditorWidget { get; set; }++ /// <summary>+ /// An event emitted after composition has started.+ /// </summary>+ [Parameter]+ public EventCallback OnDidCompositionStart { get; set; }++ /// <summary>+ /// An event emitted after composition has ended.+ /// </summary>+ [Parameter]+ public EventCallback OnDidCompositionEnd { get; set; }++ /// <summary>+ /// An event emitted when users paste text in the editor.+ /// </summary>+ [Parameter]+ public EventCallback<PasteEvent> OnDidPaste { get; set; }++ /// <summary>+ /// An event emitted on a "mouseup".+ /// </summary>+ [Parameter]+ public EventCallback<EditorMouseEvent> OnMouseUp { get; set; }++ /// <summary>+ /// An event emitted on a "mousedown".+ /// </summary>+ [Parameter]+ public EventCallback<EditorMouseEvent> OnMouseDown { get; set; }++ /// <summary>+ /// An event emitted on a "contextmenu".+ /// </summary>+ [Parameter]+ public EventCallback<EditorMouseEvent> OnContextMenu { get; set; }++ /// <summary>+ /// An event emitted on a "mousemove".+ /// </summary>+ [Parameter]+ public EventCallback<EditorMouseEvent> OnMouseMove { get; set; }++ /// <summary>+ /// An event emitted on a "mouseleave".+ /// </summary>+ [Parameter]+ public EventCallback<PartialEditorMouseEvent> OnMouseLeave { get; set; }++ /// <summary>+ /// An event emitted on a "keyup".+ /// </summary>+ [Parameter]+ public EventCallback<KeyboardEvent> OnKeyUp { get; set; }++ /// <summary>+ /// An event emitted on a "keydown".+ /// </summary>+ [Parameter]+ public EventCallback<KeyboardEvent> OnKeyDown { get; set; }++ /// <summary>+ /// An event emitted when the layout of the editor has changed.+ /// </summary>+ [Parameter]+ public EventCallback<EditorLayoutInfo> OnDidLayoutChange { get; set; }++ /// <summary>+ /// An event emitted when the content width or content height in the editor has changed.+ /// </summary>+ [Parameter]+ public EventCallback<ContentSizeChangedEvent> OnDidContentSizeChange { get; set; }++ /// <summary>+ /// An event emitted when the scroll in the editor has changed.+ /// </summary>+ [Parameter]+ public EventCallback<ScrollEvent> OnDidScrollChange { get; set; }++ protected override async Task SetEventListenersAsync()+ {+ if (OnDidCompositionEnd.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidCompositionEnd));+ }++ if (OnDidCompositionStart.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidCompositionStart));+ }++ if (OnContextMenu.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnContextMenu));+ }++ if (OnDidBlurEditorText.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidBlurEditorText));+ }++ if (OnDidBlurEditorWidget.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidBlurEditorWidget));+ }++ if (OnDidChangeConfiguration.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeConfiguration));+ }++ if (OnDidChangeCursorPosition.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeCursorPosition));+ }++ if (OnDidChangeCursorSelection.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeCursorSelection));+ }++ if (OnDidChangeModel.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeModel));+ }++ if (OnDidChangeModelContent.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeModelContent));+ }++ if (OnDidChangeModelDecorations.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeModelDecorations));+ }++ if (OnDidChangeModelLanguage.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeModelLanguage));+ }++ if (OnDidChangeModelLanguageConfiguration.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeModelLanguageConfiguration));+ }++ if (OnDidChangeModelOptions.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidChangeModelOptions));+ }++ if (OnDidContentSizeChange.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidContentSizeChange));+ }++ if (OnDidFocusEditorText.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidFocusEditorText));+ }++ if (OnDidFocusEditorWidget.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidFocusEditorWidget));+ }++ if (OnDidLayoutChange.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidLayoutChange));+ }++ if (OnDidPaste.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidPaste));+ }++ if (OnDidScrollChange.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnDidScrollChange));+ }++ if (OnKeyDown.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnKeyDown));+ }++ if (OnKeyUp.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnKeyUp));+ }++ if (OnMouseDown.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnMouseDown));+ }++ if (OnMouseLeave.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnMouseLeave));+ }++ if (OnMouseMove.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnMouseMove));+ }++ if (OnMouseUp.HasDelegate)+ {+ await SetEventListenerAsync(nameof(OnMouseUp));+ }++ await base.SetEventListenersAsync();+ }++ [JSInvokable]+ public override async Task EventCallbackAsync(string eventName, string? eventJson)+ {+ eventJson ??= string.Empty;+ var jsonOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };++ switch (eventName)+ {+ case nameof(OnDidCompositionEnd):+ await OnDidCompositionEnd.InvokeAsync(this);+ break;++ case nameof(OnDidCompositionStart):+ await OnDidCompositionStart.InvokeAsync(this);+ break;++ case nameof(OnContextMenu):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnContextMenu.InvokeAsync(JsonSerializer.Deserialize<EditorMouseEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnDidBlurEditorText):+ await OnDidBlurEditorText.InvokeAsync(this);+ break;++ case nameof(OnDidBlurEditorWidget):+ await OnDidBlurEditorWidget.InvokeAsync(this);+ break;++ case nameof(OnDidChangeConfiguration):+ await OnDidChangeConfiguration.InvokeAsync(new ConfigurationChangedEvent(JsonSerializer.Deserialize<List<bool>?>(eventJson, jsonOptions)));+ break;++ case nameof(OnDidChangeCursorPosition):+ await OnDidChangeCursorPosition.InvokeAsync(JsonSerializer.Deserialize<CursorPositionChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeCursorSelection):+ await OnDidChangeCursorSelection.InvokeAsync(JsonSerializer.Deserialize<CursorSelectionChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeModel):+ await OnDidChangeModel.InvokeAsync(JsonSerializer.Deserialize<ModelChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeModelContent):+ await OnDidChangeModelContent.InvokeAsync(JsonSerializer.Deserialize<ModelContentChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeModelDecorations):+ await OnDidChangeModelDecorations.InvokeAsync(JsonSerializer.Deserialize<ModelDecorationsChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeModelLanguage):+ await OnDidChangeModelLanguage.InvokeAsync(JsonSerializer.Deserialize<ModelLanguageChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeModelLanguageConfiguration):+ await OnDidChangeModelLanguageConfiguration.InvokeAsync(JsonSerializer.Deserialize<ModelLanguageConfigurationChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidChangeModelOptions):+ await OnDidChangeModelOptions.InvokeAsync(JsonSerializer.Deserialize<ModelOptionsChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidContentSizeChange):+ await OnDidContentSizeChange.InvokeAsync(JsonSerializer.Deserialize<ContentSizeChangedEvent>(eventJson, jsonOptions));+ break;++ case nameof(OnDidFocusEditorText):+ await OnDidFocusEditorText.InvokeAsync(this);+ break;++ case nameof(OnDidFocusEditorWidget):+ await OnDidFocusEditorWidget.InvokeAsync(this);+ break;++ case nameof(OnDidLayoutChange):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnDidLayoutChange.InvokeAsync(JsonSerializer.Deserialize<EditorLayoutInfo>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnDidPaste):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnDidPaste.InvokeAsync(JsonSerializer.Deserialize<PasteEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnDidScrollChange):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnDidScrollChange.InvokeAsync(JsonSerializer.Deserialize<ScrollEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnKeyDown):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnKeyDown.InvokeAsync(JsonSerializer.Deserialize<KeyboardEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnKeyUp):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnKeyUp.InvokeAsync(JsonSerializer.Deserialize<KeyboardEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnMouseDown):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnMouseDown.InvokeAsync(JsonSerializer.Deserialize<EditorMouseEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnMouseLeave):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnMouseLeave.InvokeAsync(JsonSerializer.Deserialize<PartialEditorMouseEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnMouseMove):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnMouseMove.InvokeAsync(JsonSerializer.Deserialize<EditorMouseEvent>(eventJson, jsonOptions));+ }+ break;++ case nameof(OnMouseUp):+ if (!string.IsNullOrEmpty(eventJson))+ {+ await OnMouseUp.InvokeAsync(JsonSerializer.Deserialize<EditorMouseEvent>(eventJson, jsonOptions));+ }+ break;+ }++ await base.EventCallbackAsync(eventName, eventJson);+ }++ /// <summary>+ /// Returns true if the text inside this editor or an editor widget has focus.+ /// </summary>+ internal ValueTask<bool> HasWidgetFocusAsync()+ => JSRuntime.InvokeAsync<bool>("devtoys.MonacoEditor.hasWidgetFocus", Id);++ /// <summary>+ /// Type the getModel() of IEditor.+ /// </summary>+ internal ValueTask<TextModel> GetModelAsync()+ => JSRuntime.InvokeAsync<TextModel>("devtoys.MonacoEditor.getInstanceModel", Id);++ /// <summary>+ /// Sets the current model attached to this editor.+ /// If the previous model was created by the editor via the value key in the options+ /// literal object, it will be destroyed. Otherwise, if the previous model was set+ /// via setModel, or the model key in the options literal object, the previous model+ /// will not be destroyed.+ /// It is safe to call setModel(null) to simply detach the current model from the editor.+ /// </summary>+ internal ValueTask<bool> SetModelAsync(TextModel model)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setInstanceModel", Id, model.Uri);++ /// <summary>+ /// Gets all the editor computed options.+ /// </summary>+ internal async Task<ComputedEditorOptions> GetOptionsAsync()+ {+ List<string> strList = await JSRuntime.InvokeAsync<List<string>>("devtoys.MonacoEditor.getOptions", Id);++ return new ComputedEditorOptions(strList);+ }+ /// <summary>+ /// Gets a specific editor option.+ /// </summary>+ internal async Task<T?> GetOptionAsync<T>(EditorOption option)+ {+ string strValue = await JSRuntime.InvokeAsync<string>("devtoys.MonacoEditor.getOption", Id, (int)option);++ return JsonSerializer.Deserialize<T>(strValue);+ }+ /// <summary>+ /// Returns the editor's configuration (without any validation or defaults).+ /// </summary>+ internal ValueTask<EditorOptions> GetRawOptionsAsync()+ => JSRuntime.InvokeAsync<EditorOptions>("devtoys.MonacoEditor.getRawOptions", Id);++ /// <summary>+ /// Get value of the current model attached to this editor.+ /// See <see cref="TextModel.GetValue(EndOfLinePreference?, bool?)"/>+ /// </summary>+ internal ValueTask<string> GetValueAsync(bool? preserveBOM = null, string? lineEnding = null)+ => JSRuntime.InvokeAsync<string>("devtoys.MonacoEditor.getValue", Id, preserveBOM, lineEnding);++ /// <summary>+ /// Set the value of the current model attached to this editor.+ /// See <see cref="TextModel.SetValue(string)"/>+ /// </summary>+ internal ValueTask<bool> SetValueAsync(string newValue)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setValue", Id, newValue);++ /// <summary>+ /// Get the width of the editor's content.+ /// This is information that is "erased" when computing `scrollWidth = Math.max(contentWidth, width)`+ /// </summary>+ internal ValueTask<double> GetContentWidthAsync()+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getContentWidth", Id);++ /// <summary>+ /// Get the scrollWidth of the editor's viewport.+ /// </summary>+ internal ValueTask<double> GetScrollWidthAsync()+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getScrollWidth", Id);++ /// <summary>+ /// Get the scrollLeft of the editor's viewport.+ /// </summary>+ internal ValueTask<double> GetScrollLeftAsync()+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getScrollLeft", Id);++ /// <summary>+ /// Get the height of the editor's content.+ /// This is information that is "erased" when computing `scrollHeight = Math.max(contentHeight, height)`+ /// </summary>+ internal ValueTask<double> GetContentHeightAsync()+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getContentHeight", Id);++ /// <summary>+ /// Get the scrollHeight of the editor's viewport.+ /// </summary>+ internal ValueTask<double> GetScrollHeightAsync()+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getScrollHeight", Id);++ /// <summary>+ /// Get the scrollTop of the editor's viewport.+ /// </summary>+ internal ValueTask<double> GetScrollTopAsync()+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getScrollTop", Id);++ /// <summary>+ /// Change the scrollLeft of the editor's viewport.+ /// </summary>+ internal ValueTask<bool> SetScrollLeftAsync(int newScrollLeft, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setScrollLeft", Id, newScrollLeft, scrollType);++ /// <summary>+ /// Change the scrollTop of the editor's viewport.+ /// </summary>+ internal ValueTask<bool> SetScrollTopAsync(int newScrollTop, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setScrollTop", Id, newScrollTop, scrollType);++ /// <summary>+ /// Change the scroll position of the editor's viewport.+ /// </summary>+ internal ValueTask<bool> SetScrollPositionAsync(NewScrollPosition position, ScrollType? scrollType = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.setScrollPosition", Id, position, scrollType);++ /// <summary>+ /// Create an "undo stop" in the undo-redo stack.+ /// </summary>+ internal ValueTask<bool> PushUndoStopAsync()+ => JSRuntime.InvokeAsync<bool>("devtoys.MonacoEditor.pushUndoStop", Id);++ /// <summary>+ /// Remove the "undo stop" in the undo-redo stack.+ /// </summary>+ internal ValueTask<bool> PopUndoStopAsync()+ => JSRuntime.InvokeAsync<bool>("devtoys.MonacoEditor.popUndoStop", Id);++ /// <summary>+ /// Execute edits on the editor.+ /// The edits will land on the undo-redo stack, but no "undo stop" will be pushed.+ /// </summary>+ /// <param name="source">The source of the call.</param>+ /// <param name="edits">The edits to execute.</param>+ /// <param name="endCursorState">Cursor state after the edits were applied.</param>+ internal ValueTask<bool> ExecuteEditsAsync(string source, List<IdentifiedSingleEditOperation> edits, List<Selection> endCursorState)+ => JSRuntime.InvokeAsync<bool>("devtoys.MonacoEditor.executeEdits", Id, source, edits, endCursorState);++ internal ValueTask<bool> ExecuteEditsAsync(string source, List<IdentifiedSingleEditOperation> edits, CursorStateComputer endCursorState)+ {+ _executeEditsLambda = endCursorState;+ return JSRuntime.InvokeAsync<bool>("devtoys.MonacoEditor.executeEdits", Id, source, edits, "function");+ }++ [JSInvokable]+ public List<Selection>? ExecuteEditsCallback(List<ValidEditOperation> inverseEditOperations)+ {+ Console.WriteLine("ExecuteEditsCallback is called : " + JsonSerializer.Serialize(inverseEditOperations));+ return _executeEditsLambda?.Invoke(inverseEditOperations) ?? null;+ }++ /// <summary>+ /// All decorations added through this call will get the ownerId of this editor.+ /// </summary>+ internal async Task<string[]> DeltaDecorationsAsync(string[] oldDecorationIds, ModelDeltaDecoration[] newDecorations)+ {+ oldDecorationIds ??= Array.Empty<string>();++ // Convert the newDecorations object into a JsonElement to get rid of the properties with null values+ string newDecorationsJson = JsonSerializer.Serialize(newDecorations, new JsonSerializerOptions+ {+ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase+ });+ JsonElement newDecorationsElement = JsonSerializer.Deserialize<JsonElement>(newDecorationsJson);+ string[] newDecorationIds = await JSRuntime.InvokeAsync<string[]>("devtoys.MonacoEditor.deltaDecorations", Id, oldDecorationIds, newDecorationsElement);+ _deltaDecorationIds.RemoveAll(d => oldDecorationIds.Any(o => o == d));+ _deltaDecorationIds.AddRange(newDecorationIds);+ return newDecorationIds;+ }++ /// <summary>+ /// Remove all the decorations.+ /// </summary>+ internal Task ResetDeltaDecorationsAsync()+ => DeltaDecorationsAsync(_deltaDecorationIds.ToArray(), Array.Empty<ModelDeltaDecoration>());++ /// <summary>+ /// Get the layout info for the editor.+ /// </summary>+ internal ValueTask<EditorLayoutInfo> GetLayoutInfoAsync()+ => JSRuntime.InvokeAsync<EditorLayoutInfo>("devtoys.MonacoEditor.getLayoutInfo", Id);++ /// <summary>+ /// Returns the ranges that are currently visible.+ /// Does not account for horizontal scrolling.+ /// </summary>+ internal ValueTask<List<Monaco.Range>> GetVisibleRangesAsync()+ => JSRuntime.InvokeAsync<List<Monaco.Range>>("devtoys.MonacoEditor.getVisibleRanges", Id);++ /// <summary>+ /// Get the vertical position (top offset) for the line's top w.r.t. to the first line.+ /// </summary>+ internal ValueTask<double> GetTopForLineNumberAsync(int lineNumber)+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getTopForLineNumber", Id, lineNumber);++ /// <summary>+ /// Get the vertical position (top offset) for the position w.r.t. to the first line.+ /// </summary>+ internal ValueTask<double> GetTopForPositionAsync(int lineNumber, int column)+ => JSRuntime.InvokeAsync<double>("devtoys.MonacoEditor.getTopForPosition", Id, lineNumber, column);++ /// <summary>+ /// Returns the editor's container dom node+ /// </summary>+ internal ValueTask<string> GetContainerDomNodeIdAsync()+ => JSRuntime.InvokeAsync<string>("devtoys.MonacoEditor.getContainerDomNodeId", Id);++ /// <summary>+ /// Returns the editor's dom node+ /// </summary>+ internal ValueTask<string> GetDomNodeIdAsync()+ => JSRuntime.InvokeAsync<string>("devtoys.MonacoEditor.getDomNodeId", Id);++ /// <summary>+ /// Get the horizontal position (left offset) for the column w.r.t to the beginning of the line.+ /// This method works only if the line `lineNumber` is currently rendered (in the editor's viewport).+ /// Use this method with caution.+ /// </summary>+ internal ValueTask<int> GetOffsetForColumnAsync(int lineNumber, int column)+ => JSRuntime.InvokeAsync<int>("devtoys.MonacoEditor.getOffsetForColumn", Id, lineNumber, column);++ /// <summary>+ /// Force an editor render now.+ /// </summary>+ internal ValueTask<bool> RenderAsync(bool? forceRedraw = null)+ => JSRuntime.InvokeVoidWithErrorHandlingAsync("devtoys.MonacoEditor.render", Id, forceRedraw);++ /// <summary>+ /// Get the hit test target at coordinates `clientX` and `clientY`.+ /// The coordinates are relative to the top-left of the viewport.+ /// </summary>+ /// <returns>Hit test target or null if the coordinates fall outside the editor or the editor has no model.</returns>+ internal ValueTask<BaseMouseTarget> GetTargetAtClientPointAsync(int clientX, int clientY)+ => JSRuntime.InvokeAsync<BaseMouseTarget>("devtoys.MonacoEditor.getTargetAtClientPoint", Id, clientX, clientY);++ /// <summary>+ /// Get the visible position for `position`.+ /// The result position takes scrolling into account and is relative to the top left corner of the editor.+ /// Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor.+ /// Explanation 2: the results of this method will not change if the container of the editor gets repositioned.+ /// Warning: the results of this method are inaccurate for positions that are outside the current editor viewport.+ /// </summary>+ internal ValueTask<ScrolledVisiblePosition> GetScrolledVisiblePositionAsync(Position position)+ => JSRuntime.InvokeAsync<ScrolledVisiblePosition>("devtoys.MonacoEditor.getScrolledVisiblePosition", Id, position);+}diff --git a/src/app/dev/DevToys.Blazor/Pages/Index.razor b/src/app/dev/DevToys.Blazor/Pages/Index.razorindex f586218c8..39bb772f6 100644--- a/src/app/dev/DevToys.Blazor/Pages/Index.razor+++ b/src/app/dev/DevToys.Blazor/Pages/Index.razor@@ -92,6 +92,7 @@<TextBlock Appearance="TextBlockAppearance.TitleLarge" Text="@guiToolViewItem.ToolInstance.LongOrShortDisplayTitle" /><!-- TODO: Place here a component that takes in argument the guiToolViewItem -->+ <MonacoEditor /><Button IsEnabled="true" @onclick="OnSetFavorite">Set favorite</Button><Button IsEnabled="false">Set favorite</Button><Button IsEnabled="true" Appearance="ButtonAppearance.Accent">Set favorite</Button>diff --git a/src/app/dev/DevToys.Blazor/package.json b/src/app/dev/DevToys.Blazor/package.jsonindex cd38d3cdb..6222a30d4 100644--- a/src/app/dev/DevToys.Blazor/package.json+++ b/src/app/dev/DevToys.Blazor/package.json@@ -27,6 +27,7 @@"gulp-sass": "^5.1.0","gulp-sourcemaps": "3.0.0","gulp-typescript": "^6.0.0-alpha.1",+ "monaco-editor": "^0.39.0","sass": "^1.49.9","ts-node": "^10.7.0","typescript": "^4.6.2",diff --git a/src/app/dev/DevToys.Blazor/tsconfig.json b/src/app/dev/DevToys.Blazor/tsconfig.jsonindex 99a3a6ae6..d790edbc4 100644--- a/src/app/dev/DevToys.Blazor/tsconfig.json+++ b/src/app/dev/DevToys.Blazor/tsconfig.json@@ -1,5 +1,5 @@{- "compileOnSave": false,+ "compileOnSave": true,"compilerOptions": {"target": "es2015", // Warning: Monaco editor breaks when using something else than es2015"lib": [ "es2015", "DOM" ], // Warning: Monaco editor breaks when using something else than es2015diff --git a/src/app/dev/platforms/desktop/DevToys.MacOS/wwwroot/index.html b/src/app/dev/platforms/desktop/DevToys.MacOS/wwwroot/index.htmlindex 5d37d4c99..0e4bad595 100644--- a/src/app/dev/platforms/desktop/DevToys.MacOS/wwwroot/index.html+++ b/src/app/dev/platforms/desktop/DevToys.MacOS/wwwroot/index.html@@ -27,6 +27,8 @@<a class="dismiss">🗙</a></div>+ <script src="_content/DevToys.Blazor/lib/monaco-editor/min/vs/loader.js"></script>+ <script src="_content/DevToys.Blazor/lib/monaco-editor/min/vs/editor/editor.main.js"></script><!-- TODO: Looks like autostart isn't necessary and we can reuse the same file from the Windows project? --><script src="_framework/blazor.webview.js" autostart="false"></script><!-- <script src="_framework/blazor.webview.js"></script> -->diff --git a/src/app/dev/platforms/desktop/DevToys.Windows/wwwroot/index.html b/src/app/dev/platforms/desktop/DevToys.Windows/wwwroot/index.htmlindex b566bff3b..367fd5945 100644--- a/src/app/dev/platforms/desktop/DevToys.Windows/wwwroot/index.html+++ b/src/app/dev/platforms/desktop/DevToys.Windows/wwwroot/index.html@@ -27,6 +27,8 @@<a class="dismiss">🗙</a></div>+ <script src="_content/DevToys.Blazor/lib/monaco-editor/min/vs/loader.js"></script>+ <script src="_content/DevToys.Blazor/lib/monaco-editor/min/vs/editor/editor.main.js"></script><!--<script src="_framework/blazor.webview.js" autostart="false"></script>--><script src="_framework/blazor.webview.js"></script>diff --git a/tools/Restore-MonacoEditor.ps1 b/tools/Restore-MonacoEditor.ps1index b1f44cabc..a398a09b2 100644--- a/tools/Restore-MonacoEditor.ps1+++ b/tools/Restore-MonacoEditor.ps1@@ -40,9 +40,10 @@ Invoke-WebRequest -Uri $monaco_tgz_url -OutFile ".\$temp_dir_name\monaco.tgz"Write-Host "Extracting..."-mkdir "$tools_dir\$temp_dir_name\monaco"+New-Item -Path "$tools_dir\$temp_dir_name\monaco" -ItemType Directory | out-nulltar -zxf "$tools_dir\$temp_dir_name\monaco.tgz" -C "$tools_dir\$temp_dir_name\monaco"+New-Item -Path "$destination_dir\min" -ItemType Directory | out-nullCopy-Item -Path ".\$temp_dir_name\monaco\package\min\*" -Destination "$destination_dir\min" -Recurse# Clean-up Temp Dirdiff --git a/tools/monaco-editor-version-number.txt b/tools/monaco-editor-version-number.txtindex e707c47f6..ed3892ec1 100644--- a/tools/monaco-editor-version-number.txt+++ b/tools/monaco-editor-version-number.txt@@ -1,3 +1 @@-0.33.0--# Can't use 0.34.1 due to https://github.com/microsoft/monaco-editor/issues/3237\ No newline at end of file+0.39.0\ No newline at end of file