@eclipse-lyra/extension-monaco-editor 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ "namespace": "extensions",
3
+ "en": {
4
+ "EXT_MONACO_NAME": "Monaco Code Editor",
5
+ "EXT_MONACO_DESC": "Code editor with syntax highlighting, code completion, and Python execution support"
6
+ },
7
+ "de": {
8
+ "EXT_MONACO_NAME": "Monaco-Code-Editor",
9
+ "EXT_MONACO_DESC": "Code-Editor mit Syntaxhervorhebung, Code-Vervollständigung und Python-Ausführungsunterstützung"
10
+ }
11
+ };
12
+
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export { MONACO_EDITOR_TOOLBAR_TARGET_PREFIX } from './monaco-toolbar-constants';
2
+ export { LyraMonacoWidget } from './monaco-widget';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mCAAmC,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,186 @@
1
+ import { contributionRegistry, SYSTEM_LANGUAGE_BUNDLES, i18nLazy, extensionRegistry } from "@eclipse-lyra/core";
2
+ import pkg from "../package.json";
3
+ import * as monaco from "monaco-editor";
4
+ import styles from "monaco-editor/min/vs/editor/editor.main.css?raw";
5
+ import { property, customElement } from "lit/decorators.js";
6
+ import { css, LitElement, html } from "lit";
7
+ import { createRef, ref } from "lit/directives/ref.js";
8
+ const namespace = "extensions";
9
+ const en = { "EXT_MONACO_NAME": "Monaco Code Editor", "EXT_MONACO_DESC": "Code editor with syntax highlighting, code completion, and Python execution support" };
10
+ const de = { "EXT_MONACO_NAME": "Monaco-Code-Editor", "EXT_MONACO_DESC": "Code-Editor mit Syntaxhervorhebung, Code-Vervollständigung und Python-Ausführungsunterstützung" };
11
+ const bundle = {
12
+ namespace,
13
+ en,
14
+ de
15
+ };
16
+ const MONACO_EDITOR_TOOLBAR_TARGET_PREFIX = "toolbar:system.monaco-editor";
17
+ var __defProp = Object.defineProperty;
18
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
19
+ var __decorateClass = (decorators, target, key, kind) => {
20
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
+ if (decorator = decorators[i])
23
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
+ if (kind && result) __defProp(target, key, result);
25
+ return result;
26
+ };
27
+ const workerMap = {
28
+ "json": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgSlNPTldvcmtlciB9IGZyb20gJy4vanNvbldvcmtlci5qcyc7CgpzZWxmLm9ubWVzc2FnZSA9ICgpID0+IHsKICBpbml0aWFsaXplKChjdHgsIGNyZWF0ZURhdGEpID0+IHsKICAgIHJldHVybiBuZXcgSlNPTldvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
29
+ "css": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgQ1NTV29ya2VyIH0gZnJvbSAnLi9jc3NXb3JrZXIuanMnOwoKc2VsZi5vbm1lc3NhZ2UgPSAoKSA9PiB7CiAgaW5pdGlhbGl6ZSgoY3R4LCBjcmVhdGVEYXRhKSA9PiB7CiAgICByZXR1cm4gbmV3IENTU1dvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
30
+ "scss": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgQ1NTV29ya2VyIH0gZnJvbSAnLi9jc3NXb3JrZXIuanMnOwoKc2VsZi5vbm1lc3NhZ2UgPSAoKSA9PiB7CiAgaW5pdGlhbGl6ZSgoY3R4LCBjcmVhdGVEYXRhKSA9PiB7CiAgICByZXR1cm4gbmV3IENTU1dvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
31
+ "less": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgQ1NTV29ya2VyIH0gZnJvbSAnLi9jc3NXb3JrZXIuanMnOwoKc2VsZi5vbm1lc3NhZ2UgPSAoKSA9PiB7CiAgaW5pdGlhbGl6ZSgoY3R4LCBjcmVhdGVEYXRhKSA9PiB7CiAgICByZXR1cm4gbmV3IENTU1dvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
32
+ "html": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgSFRNTFdvcmtlciB9IGZyb20gJy4vaHRtbFdvcmtlci5qcyc7CgpzZWxmLm9ubWVzc2FnZSA9ICgpID0+IHsKICBpbml0aWFsaXplKChjdHgsIGNyZWF0ZURhdGEpID0+IHsKICAgIHJldHVybiBuZXcgSFRNTFdvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
33
+ "handlebars": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgSFRNTFdvcmtlciB9IGZyb20gJy4vaHRtbFdvcmtlci5qcyc7CgpzZWxmLm9ubWVzc2FnZSA9ICgpID0+IHsKICBpbml0aWFsaXplKChjdHgsIGNyZWF0ZURhdGEpID0+IHsKICAgIHJldHVybiBuZXcgSFRNTFdvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
34
+ "razor": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgSFRNTFdvcmtlciB9IGZyb20gJy4vaHRtbFdvcmtlci5qcyc7CgpzZWxmLm9ubWVzc2FnZSA9ICgpID0+IHsKICBpbml0aWFsaXplKChjdHgsIGNyZWF0ZURhdGEpID0+IHsKICAgIHJldHVybiBuZXcgSFRNTFdvcmtlcihjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9Owo=", import.meta.url).href,
35
+ "typescript": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0ICogYXMgdHlwZXNjcmlwdFNlcnZpY2VzIGZyb20gJy4vbGliL3R5cGVzY3JpcHRTZXJ2aWNlcy5qcyc7CmV4cG9ydCB7IHR5cGVzY3JpcHRTZXJ2aWNlcyBhcyB0cyB9OwppbXBvcnQgeyBjcmVhdGUgfSBmcm9tICcuL3RzV29ya2VyLmpzJzsKZXhwb3J0IHsgVHlwZVNjcmlwdFdvcmtlciB9IGZyb20gJy4vdHNXb3JrZXIuanMnOwpleHBvcnQgeyBsaWJGaWxlTWFwIH0gZnJvbSAnLi9saWIvbGliLmpzJzsKCnNlbGYub25tZXNzYWdlID0gKCkgPT4gewogIGluaXRpYWxpemUoKGN0eCwgY3JlYXRlRGF0YSkgPT4gewogICAgcmV0dXJuIGNyZWF0ZShjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9OwoKZXhwb3J0IHsgY3JlYXRlLCBpbml0aWFsaXplIH07Cg==", import.meta.url).href,
36
+ "javascript": new URL("data:text/javascript;base64,aW1wb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uLy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0ICogYXMgdHlwZXNjcmlwdFNlcnZpY2VzIGZyb20gJy4vbGliL3R5cGVzY3JpcHRTZXJ2aWNlcy5qcyc7CmV4cG9ydCB7IHR5cGVzY3JpcHRTZXJ2aWNlcyBhcyB0cyB9OwppbXBvcnQgeyBjcmVhdGUgfSBmcm9tICcuL3RzV29ya2VyLmpzJzsKZXhwb3J0IHsgVHlwZVNjcmlwdFdvcmtlciB9IGZyb20gJy4vdHNXb3JrZXIuanMnOwpleHBvcnQgeyBsaWJGaWxlTWFwIH0gZnJvbSAnLi9saWIvbGliLmpzJzsKCnNlbGYub25tZXNzYWdlID0gKCkgPT4gewogIGluaXRpYWxpemUoKGN0eCwgY3JlYXRlRGF0YSkgPT4gewogICAgcmV0dXJuIGNyZWF0ZShjdHgsIGNyZWF0ZURhdGEpOwogIH0pOwp9OwoKZXhwb3J0IHsgY3JlYXRlLCBpbml0aWFsaXplIH07Cg==", import.meta.url).href
37
+ };
38
+ self.MonacoEnvironment = {
39
+ getWorkerUrl(_, label) {
40
+ return workerMap[label] || new URL("data:text/javascript;base64,aW1wb3J0IHsgaXNXb3JrZXJJbml0aWFsaXplZCB9IGZyb20gJy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKZXhwb3J0IHsgaW5pdGlhbGl6ZSB9IGZyb20gJy4uL2NvbW1vbi9pbml0aWFsaXplLmpzJzsKaW1wb3J0IHsgc3RhcnQgfSBmcm9tICcuL2VkaXRvci53b3JrZXIuc3RhcnQuanMnOwoKc2VsZi5vbm1lc3NhZ2UgPSAoKSA9PiB7CiAgaWYgKCFpc1dvcmtlckluaXRpYWxpemVkKCkpIHsKICAgIHN0YXJ0KCgpID0+IHsKICAgICAgcmV0dXJuIHt9OwogICAgfSk7CiAgfQp9Owo=", import.meta.url).href;
41
+ }
42
+ };
43
+ let LyraMonacoWidget = class extends LitElement {
44
+ constructor() {
45
+ super(...arguments);
46
+ this.readOnly = false;
47
+ this.theme = "vs-dark";
48
+ this.containerRef = createRef();
49
+ }
50
+ ensureEditor() {
51
+ const container = this.containerRef.value;
52
+ if (!container || this.editor) return;
53
+ if (this.value === void 0) return;
54
+ const uri = this.uri != null ? monaco.Uri.file(this.uri) : void 0;
55
+ this.model = monaco.editor.createModel(this.value, this.language, uri);
56
+ this.editor = monaco.editor.create(container, {
57
+ theme: this.theme,
58
+ automaticLayout: false
59
+ });
60
+ this.model.onDidChangeContent(() => {
61
+ if (this.readOnly) return;
62
+ this.dispatchEvent(new CustomEvent("content-change", { bubbles: true, composed: true }));
63
+ });
64
+ this.editor.setModel(this.model);
65
+ }
66
+ firstUpdated(_changedProperties) {
67
+ super.firstUpdated(_changedProperties);
68
+ this.ensureEditor();
69
+ }
70
+ updated(changedProperties) {
71
+ super.updated(changedProperties);
72
+ if (changedProperties.has("value") || changedProperties.has("language") || changedProperties.has("uri")) {
73
+ this.ensureEditor();
74
+ }
75
+ }
76
+ disconnectedCallback() {
77
+ this.dispose();
78
+ super.disconnectedCallback();
79
+ }
80
+ dispose() {
81
+ this.model?.dispose();
82
+ this.editor?.dispose();
83
+ this.model = void 0;
84
+ this.editor = void 0;
85
+ }
86
+ getEditor() {
87
+ return this.editor;
88
+ }
89
+ getModel() {
90
+ return this.model;
91
+ }
92
+ getContent() {
93
+ return this.model?.getValue() ?? null;
94
+ }
95
+ getLanguage() {
96
+ return this.model?.getLanguageId()?.toLowerCase() ?? null;
97
+ }
98
+ isLanguage(lang) {
99
+ return this.getLanguage() === lang.toLowerCase();
100
+ }
101
+ getSelection() {
102
+ if (!this.editor || !this.model) return null;
103
+ try {
104
+ const selection = this.editor.getSelection();
105
+ if (!selection || selection.isEmpty()) return null;
106
+ return this.model.getValueInRange(selection) || null;
107
+ } catch {
108
+ return null;
109
+ }
110
+ }
111
+ getSnippet(lines = 5) {
112
+ if (!this.editor || !this.model) return null;
113
+ try {
114
+ const position = this.editor.getPosition();
115
+ if (!position) return null;
116
+ const n = isNaN(lines) || lines < 0 ? 5 : lines;
117
+ const cursorLineNumber = position.lineNumber;
118
+ const totalLines = this.model.getLineCount();
119
+ const startLine = Math.max(1, cursorLineNumber - n);
120
+ const endLine = Math.min(totalLines, cursorLineNumber + n);
121
+ const snippet = this.model.getValueInRange({
122
+ startLineNumber: startLine,
123
+ startColumn: 1,
124
+ endLineNumber: endLine,
125
+ endColumn: this.model.getLineMaxColumn(endLine)
126
+ });
127
+ return { snippet, cursorLine: cursorLineNumber };
128
+ } catch {
129
+ return null;
130
+ }
131
+ }
132
+ render() {
133
+ return html`
134
+ <style>${styles}</style>
135
+ <div class="monaco-editor-container" ${ref(this.containerRef)}></div>
136
+ `;
137
+ }
138
+ };
139
+ LyraMonacoWidget.styles = css`
140
+ :host {
141
+ display: flex;
142
+ flex-direction: column;
143
+ position: relative;
144
+ width: 100%;
145
+ height: 100%;
146
+ }
147
+ div.monaco-editor-container {
148
+ position: absolute;
149
+ top: 0;
150
+ left: 0;
151
+ right: 0;
152
+ bottom: 0;
153
+ }
154
+ `;
155
+ __decorateClass([
156
+ property({ attribute: false })
157
+ ], LyraMonacoWidget.prototype, "value", 2);
158
+ __decorateClass([
159
+ property()
160
+ ], LyraMonacoWidget.prototype, "language", 2);
161
+ __decorateClass([
162
+ property()
163
+ ], LyraMonacoWidget.prototype, "uri", 2);
164
+ __decorateClass([
165
+ property({ type: Boolean })
166
+ ], LyraMonacoWidget.prototype, "readOnly", 2);
167
+ __decorateClass([
168
+ property()
169
+ ], LyraMonacoWidget.prototype, "theme", 2);
170
+ LyraMonacoWidget = __decorateClass([
171
+ customElement("lyra-monaco-widget")
172
+ ], LyraMonacoWidget);
173
+ contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle);
174
+ const t = i18nLazy("extensions");
175
+ extensionRegistry.registerExtension({
176
+ id: pkg.name,
177
+ name: t("EXT_MONACO_NAME"),
178
+ description: t("EXT_MONACO_DESC"),
179
+ loader: () => import("./monaco-editor-extension-BxJuxau2.js"),
180
+ icon: "file-pen"
181
+ });
182
+ export {
183
+ LyraMonacoWidget,
184
+ MONACO_EDITOR_TOOLBAR_TARGET_PREFIX
185
+ };
186
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/monaco-toolbar-constants.ts","../src/monaco-widget.ts","../src/index.ts"],"sourcesContent":["export const MONACO_EDITOR_TOOLBAR_TARGET_PREFIX = 'toolbar:system.monaco-editor';\n","import * as monaco from 'monaco-editor';\nimport styles from \"monaco-editor/min/vs/editor/editor.main.css?raw\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { LitElement, PropertyValues } from \"lit\";\nimport { css, html } from \"lit\";\nimport { createRef, ref } from \"lit/directives/ref.js\";\n\nconst workerMap: Record<string, string> = {\n 'json': new URL('monaco-editor/esm/vs/language/json/json.worker.js', import.meta.url).href,\n 'css': new URL('monaco-editor/esm/vs/language/css/css.worker.js', import.meta.url).href,\n 'scss': new URL('monaco-editor/esm/vs/language/css/css.worker.js', import.meta.url).href,\n 'less': new URL('monaco-editor/esm/vs/language/css/css.worker.js', import.meta.url).href,\n 'html': new URL('monaco-editor/esm/vs/language/html/html.worker.js', import.meta.url).href,\n 'handlebars': new URL('monaco-editor/esm/vs/language/html/html.worker.js', import.meta.url).href,\n 'razor': new URL('monaco-editor/esm/vs/language/html/html.worker.js', import.meta.url).href,\n 'typescript': new URL('monaco-editor/esm/vs/language/typescript/ts.worker.js', import.meta.url).href,\n 'javascript': new URL('monaco-editor/esm/vs/language/typescript/ts.worker.js', import.meta.url).href,\n};\n\nself.MonacoEnvironment = {\n getWorkerUrl(_: unknown, label: string) {\n return workerMap[label] || new URL('monaco-editor/esm/vs/editor/editor.worker.js', import.meta.url).href;\n }\n};\n\n@customElement('lyra-monaco-widget')\nexport class LyraMonacoWidget extends LitElement {\n @property({ attribute: false })\n value?: string;\n\n @property()\n language?: string;\n\n @property()\n uri?: string;\n\n @property({ type: Boolean })\n readOnly: boolean = false;\n\n @property()\n theme: string = 'vs-dark';\n\n private containerRef = createRef<HTMLElement>();\n private editor?: monaco.editor.IStandaloneCodeEditor;\n private model?: monaco.editor.ITextModel;\n\n private ensureEditor() {\n const container = this.containerRef.value;\n if (!container || this.editor) return;\n if (this.value === undefined) return;\n\n const uri = this.uri != null ? monaco.Uri.file(this.uri) : undefined;\n this.model = monaco.editor.createModel(this.value, this.language, uri);\n this.editor = monaco.editor.create(container, {\n theme: this.theme,\n automaticLayout: false,\n });\n this.model.onDidChangeContent(() => {\n if (this.readOnly) return;\n this.dispatchEvent(new CustomEvent('content-change', { bubbles: true, composed: true }));\n });\n this.editor.setModel(this.model);\n }\n\n protected firstUpdated(_changedProperties: PropertyValues) {\n super.firstUpdated(_changedProperties);\n this.ensureEditor();\n }\n\n protected updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n if (changedProperties.has('value') || changedProperties.has('language') || changedProperties.has('uri')) {\n this.ensureEditor();\n }\n }\n\n disconnectedCallback() {\n this.dispose();\n super.disconnectedCallback();\n }\n\n public dispose() {\n this.model?.dispose();\n this.editor?.dispose();\n this.model = undefined;\n this.editor = undefined;\n }\n\n public getEditor(): monaco.editor.IStandaloneCodeEditor | undefined {\n return this.editor;\n }\n\n public getModel(): monaco.editor.ITextModel | undefined {\n return this.model;\n }\n\n public getContent(): string | null {\n return this.model?.getValue() ?? null;\n }\n\n public getLanguage(): string | null {\n return this.model?.getLanguageId()?.toLowerCase() ?? null;\n }\n\n public isLanguage(lang: string): boolean {\n return this.getLanguage() === lang.toLowerCase();\n }\n\n public getSelection(): string | null {\n if (!this.editor || !this.model) return null;\n try {\n const selection = this.editor.getSelection();\n if (!selection || selection.isEmpty()) return null;\n return this.model.getValueInRange(selection) || null;\n } catch {\n return null;\n }\n }\n\n public getSnippet(lines: number = 5): { snippet: string; cursorLine: number } | null {\n if (!this.editor || !this.model) return null;\n try {\n const position = this.editor.getPosition();\n if (!position) return null;\n const n = isNaN(lines) || lines < 0 ? 5 : lines;\n const cursorLineNumber = position.lineNumber;\n const totalLines = this.model.getLineCount();\n const startLine = Math.max(1, cursorLineNumber - n);\n const endLine = Math.min(totalLines, cursorLineNumber + n);\n const snippet = this.model.getValueInRange({\n startLineNumber: startLine,\n startColumn: 1,\n endLineNumber: endLine,\n endColumn: this.model.getLineMaxColumn(endLine),\n });\n return { snippet, cursorLine: cursorLineNumber };\n } catch {\n return null;\n }\n }\n\n render() {\n return html`\n <style>${styles}</style>\n <div class=\"monaco-editor-container\" ${ref(this.containerRef)}></div>\n `;\n }\n\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n height: 100%;\n }\n div.monaco-editor-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lyra-monaco-widget': LyraMonacoWidget;\n }\n}\n","import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@eclipse-lyra/core';\nimport bundle from './i18n.json';\nimport pkg from '../package.json';\n\ncontributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);\n\nconst t = i18nLazy('extensions');\n\nextensionRegistry.registerExtension({\n id: pkg.name,\n name: t('EXT_MONACO_NAME'),\n description: t('EXT_MONACO_DESC'),\n loader: () => import(\"./monaco-editor-extension\"),\n icon: \"file-pen\",\n});\n\nexport { MONACO_EDITOR_TOOLBAR_TARGET_PREFIX } from './monaco-toolbar-constants';\nexport { LyraMonacoWidget } from './monaco-widget';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAO,MAAM,sCAAsC;;;;;;;;;;;ACOnD,MAAM,YAAoC;AAAA,EACt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,qBAAqB,qBAAqB,yBAAyB,MAAa;AAEhF,MAAM,IAAI,SAAS,YAAY;AAE/B,kBAAkB,kBAAkB;AAAA,EAClC,IAAI,IAAI;AAAA,EACR,MAAM,EAAE,iBAAiB;AAAA,EACzB,aAAa,EAAE,iBAAiB;AAAA,EAChC,QAAQ,MAAM,OAAO,uCAA2B;AAAA,EAChD,MAAM;AACR,CAAC;"}
@@ -0,0 +1,114 @@
1
+ import { property, state, customElement } from "lit/decorators.js";
2
+ import { LyraPart } from "@eclipse-lyra/core";
3
+ import { css, html } from "lit";
4
+ import { createRef, ref } from "lit/directives/ref.js";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let LyraMonacoEditor = class extends LyraPart {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.readOnly = false;
19
+ this.initialContent = void 0;
20
+ this.initialUri = void 0;
21
+ this.initialLanguage = void 0;
22
+ this.widgetRef = createRef();
23
+ this._onContentChange = () => {
24
+ this.markDirty(true);
25
+ };
26
+ }
27
+ async doInitUI() {
28
+ const file = this.input.data;
29
+ const textContents = await file.getContents();
30
+ this.initialContent = textContents;
31
+ this.initialUri = file.getName();
32
+ this.initialLanguage = void 0;
33
+ this.requestUpdate();
34
+ }
35
+ getEditor() {
36
+ return this.widgetRef.value?.getEditor() ?? void 0;
37
+ }
38
+ save() {
39
+ const value = this.widgetRef.value?.getContent() ?? "";
40
+ this.input?.data.saveContents(value);
41
+ this.markDirty(false);
42
+ }
43
+ doClose() {
44
+ this.widgetRef.value?.dispose();
45
+ }
46
+ getLanguage() {
47
+ return this.widgetRef.value?.getLanguage() ?? null;
48
+ }
49
+ isLanguage(lang) {
50
+ return this.widgetRef.value?.isLanguage(lang) ?? false;
51
+ }
52
+ getContent() {
53
+ return this.widgetRef.value?.getContent() ?? null;
54
+ }
55
+ getSelection() {
56
+ return this.widgetRef.value?.getSelection() ?? null;
57
+ }
58
+ getSnippet(lines = 5) {
59
+ return this.widgetRef.value?.getSnippet(lines) ?? null;
60
+ }
61
+ getFilePath() {
62
+ return this.input?.data?.getWorkspacePath() ?? null;
63
+ }
64
+ render() {
65
+ if (this.initialContent === void 0) {
66
+ return html`<div class="monaco-editor-placeholder"></div>`;
67
+ }
68
+ return html`
69
+ <lyra-monaco-widget
70
+ .value=${this.initialContent}
71
+ .uri=${this.initialUri}
72
+ .language=${this.initialLanguage}
73
+ .readOnly=${this.readOnly}
74
+ @content-change=${this._onContentChange}
75
+ ${ref(this.widgetRef)}
76
+ ></lyra-monaco-widget>
77
+ `;
78
+ }
79
+ };
80
+ LyraMonacoEditor.styles = css`
81
+ :host {
82
+ display: flex;
83
+ flex-direction: column;
84
+ position: relative;
85
+ width: 100%;
86
+ height: 100%;
87
+ }
88
+ .monaco-editor-placeholder {
89
+ flex: 1;
90
+ min-height: 0;
91
+ }
92
+ `;
93
+ __decorateClass([
94
+ property({ attribute: false })
95
+ ], LyraMonacoEditor.prototype, "input", 2);
96
+ __decorateClass([
97
+ property()
98
+ ], LyraMonacoEditor.prototype, "readOnly", 2);
99
+ __decorateClass([
100
+ state()
101
+ ], LyraMonacoEditor.prototype, "initialContent", 2);
102
+ __decorateClass([
103
+ state()
104
+ ], LyraMonacoEditor.prototype, "initialUri", 2);
105
+ __decorateClass([
106
+ state()
107
+ ], LyraMonacoEditor.prototype, "initialLanguage", 2);
108
+ LyraMonacoEditor = __decorateClass([
109
+ customElement("lyra-monaco-editor")
110
+ ], LyraMonacoEditor);
111
+ export {
112
+ LyraMonacoEditor
113
+ };
114
+ //# sourceMappingURL=monaco-editor-CyKUtT_v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-editor-CyKUtT_v.js","sources":["../src/monaco-editor.ts"],"sourcesContent":["import { customElement, property, state } from \"lit/decorators.js\";\nimport { LyraPart } from \"@eclipse-lyra/core\";\nimport { css, html } from \"lit\";\nimport { createRef, ref } from \"lit/directives/ref.js\";\nimport { EditorInput, EditorContentProvider } from \"@eclipse-lyra/core\";\nimport type { LyraMonacoWidget } from \"./monaco-widget\";\n\n@customElement('lyra-monaco-editor')\nexport class LyraMonacoEditor extends LyraPart implements EditorContentProvider {\n @property({ attribute: false })\n public input?: EditorInput;\n @property()\n public readOnly: boolean = false;\n\n @state()\n private initialContent: string | undefined = undefined;\n @state()\n private initialUri: string | undefined = undefined;\n @state()\n private initialLanguage: string | undefined = undefined;\n\n private widgetRef = createRef<LyraMonacoWidget>();\n\n protected async doInitUI() {\n const file = this.input!.data;\n const textContents = await file.getContents();\n this.initialContent = textContents;\n this.initialUri = file.getName();\n this.initialLanguage = undefined;\n this.requestUpdate();\n }\n\n private _onContentChange = () => {\n this.markDirty(true);\n };\n\n public getEditor() {\n return this.widgetRef.value?.getEditor() ?? undefined;\n }\n\n save(): void {\n const value = this.widgetRef.value?.getContent() ?? '';\n this.input?.data.saveContents(value);\n this.markDirty(false);\n }\n\n protected doClose() {\n this.widgetRef.value?.dispose();\n }\n\n public getLanguage(): string | null {\n return this.widgetRef.value?.getLanguage() ?? null;\n }\n\n public isLanguage(lang: string): boolean {\n return this.widgetRef.value?.isLanguage(lang) ?? false;\n }\n\n public getContent(): string | null {\n return this.widgetRef.value?.getContent() ?? null;\n }\n\n public getSelection(): string | null {\n return this.widgetRef.value?.getSelection() ?? null;\n }\n\n public getSnippet(lines: number = 5): { snippet: string; cursorLine: number } | null {\n return this.widgetRef.value?.getSnippet(lines) ?? null;\n }\n\n public getFilePath(): string | null {\n return this.input?.data?.getWorkspacePath() ?? null;\n }\n\n render() {\n if (this.initialContent === undefined) {\n return html`<div class=\"monaco-editor-placeholder\"></div>`;\n }\n return html`\n <lyra-monaco-widget\n .value=${this.initialContent}\n .uri=${this.initialUri}\n .language=${this.initialLanguage}\n .readOnly=${this.readOnly}\n @content-change=${this._onContentChange}\n ${ref(this.widgetRef)}\n ></lyra-monaco-widget>\n `;\n }\n\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n height: 100%;\n }\n .monaco-editor-placeholder {\n flex: 1;\n min-height: 0;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lyra-monaco-editor': LyraMonacoEditor;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAQO,IAAM,mBAAN,cAA+B,SAA0C;AAAA,EAAzE,cAAA;AAAA,UAAA,GAAA,SAAA;AAIH,SAAO,WAAoB;AAG3B,SAAQ,iBAAqC;AAE7C,SAAQ,aAAiC;AAEzC,SAAQ,kBAAsC;AAE9C,SAAQ,YAAY,UAAA;AAWpB,SAAQ,mBAAmB,MAAM;AAC7B,WAAK,UAAU,IAAI;AAAA,IACvB;AAAA,EAAA;AAAA,EAXA,MAAgB,WAAW;AACvB,UAAM,OAAO,KAAK,MAAO;AACzB,UAAM,eAAe,MAAM,KAAK,YAAA;AAChC,SAAK,iBAAiB;AACtB,SAAK,aAAa,KAAK,QAAA;AACvB,SAAK,kBAAkB;AACvB,SAAK,cAAA;AAAA,EACT;AAAA,EAMO,YAAY;AACf,WAAO,KAAK,UAAU,OAAO,UAAA,KAAe;AAAA,EAChD;AAAA,EAEA,OAAa;AACT,UAAM,QAAQ,KAAK,UAAU,OAAO,gBAAgB;AACpD,SAAK,OAAO,KAAK,aAAa,KAAK;AACnC,SAAK,UAAU,KAAK;AAAA,EACxB;AAAA,EAEU,UAAU;AAChB,SAAK,UAAU,OAAO,QAAA;AAAA,EAC1B;AAAA,EAEO,cAA6B;AAChC,WAAO,KAAK,UAAU,OAAO,YAAA,KAAiB;AAAA,EAClD;AAAA,EAEO,WAAW,MAAuB;AACrC,WAAO,KAAK,UA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-lyra/core";
3
+ import "./index.js";
4
+ editorRegistry.registerEditorInputHandler({
5
+ editorId: "system.monaco-editor",
6
+ label: "Code",
7
+ icon: "file-pen",
8
+ lazyInit: async () => {
9
+ await import("./monaco-editor-CyKUtT_v.js");
10
+ },
11
+ canHandle: (input) => input instanceof File && !input.getName().toLowerCase().endsWith(".py"),
12
+ handle: async (input) => {
13
+ const editorInput = {
14
+ title: input.getName(),
15
+ data: input,
16
+ key: input.getName(),
17
+ icon: "file-pen",
18
+ noOverflow: false,
19
+ state: {}
20
+ };
21
+ editorInput.widgetFactory = () => html`
22
+ <lyra-monaco-editor .input=${editorInput}></lyra-monaco-editor>`;
23
+ return editorInput;
24
+ }
25
+ });
26
+ //# sourceMappingURL=monaco-editor-extension-BxJuxau2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-editor-extension-BxJuxau2.js","sources":["../src/monaco-editor-extension.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { EditorInput, editorRegistry, File } from \"@eclipse-lyra/core\";\n\nimport \"./monaco-widget\";\n\neditorRegistry.registerEditorInputHandler({\n editorId: \"system.monaco-editor\",\n label: \"Code\",\n icon: \"file-pen\",\n lazyInit: async () => {\n await import('./monaco-editor');\n },\n canHandle: (input: unknown) =>\n input instanceof File && !input.getName().toLowerCase().endsWith(\".py\"),\n handle: async (input: File) => {\n const editorInput = {\n title: input.getName(),\n data: input,\n key: input.getName(),\n icon: \"file-pen\",\n noOverflow: false,\n state: {},\n } as EditorInput\n editorInput.widgetFactory = () => html`\n <lyra-monaco-editor .input=${editorInput}></lyra-monaco-editor>`\n return editorInput;\n }\n})\n"],"names":[],"mappings":";;;AAKA,eAAe,2BAA2B;AAAA,EACtC,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU,YAAY;AAClB,UAAM,OAAO,6BAAiB;AAAA,EAClC;AAAA,EACA,WAAW,CAAC,UACR,iBAAiB,QAAQ,CAAC,MAAM,UAAU,cAAc,SAAS,KAAK;AAAA,EAC1E,QAAQ,OAAO,UAAgB;AAC3B,UAAM,cAAc;AAAA,MAChB,OAAO,MAAM,QAAA;AAAA,MACb,MAAM;AAAA,MACN,KAAK,MAAM,QAAA;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,OAAO,CAAA;AAAA,IAAC;AAEZ,gBAAY,gBAAgB,MAAM;AAAA,yCACD,WAAW;AAC5C,WAAO;AAAA,EACX;AACJ,CAAC;"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=monaco-editor-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-editor-extension.d.ts","sourceRoot":"","sources":["../src/monaco-editor-extension.ts"],"names":[],"mappings":"AAGA,OAAO,iBAAiB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { LyraPart, EditorInput, EditorContentProvider } from '@eclipse-lyra/core';
2
+ export declare class LyraMonacoEditor extends LyraPart implements EditorContentProvider {
3
+ input?: EditorInput;
4
+ readOnly: boolean;
5
+ private initialContent;
6
+ private initialUri;
7
+ private initialLanguage;
8
+ private widgetRef;
9
+ protected doInitUI(): Promise<void>;
10
+ private _onContentChange;
11
+ getEditor(): import("monaco-editor").editor.IStandaloneCodeEditor | undefined;
12
+ save(): void;
13
+ protected doClose(): void;
14
+ getLanguage(): string | null;
15
+ isLanguage(lang: string): boolean;
16
+ getContent(): string | null;
17
+ getSelection(): string | null;
18
+ getSnippet(lines?: number): {
19
+ snippet: string;
20
+ cursorLine: number;
21
+ } | null;
22
+ getFilePath(): string | null;
23
+ render(): import('lit-html').TemplateResult<1>;
24
+ static styles: import('lit').CSSResult;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ 'lyra-monaco-editor': LyraMonacoEditor;
29
+ }
30
+ }
31
+ //# sourceMappingURL=monaco-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-editor.d.ts","sourceRoot":"","sources":["../src/monaco-editor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGxE,qBACa,gBAAiB,SAAQ,QAAS,YAAW,qBAAqB;IAEpE,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB,QAAQ,EAAE,OAAO,CAAS;IAGjC,OAAO,CAAC,cAAc,CAAiC;IAEvD,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO,CAAC,eAAe,CAAiC;IAExD,OAAO,CAAC,SAAS,CAAiC;cAElC,QAAQ;IASxB,OAAO,CAAC,gBAAgB,CAEtB;IAEK,SAAS;IAIhB,IAAI,IAAI,IAAI;IAMZ,SAAS,CAAC,OAAO;IAIV,WAAW,IAAI,MAAM,GAAG,IAAI;IAI5B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,UAAU,IAAI,MAAM,GAAG,IAAI;IAI3B,YAAY,IAAI,MAAM,GAAG,IAAI;IAI7B,UAAU,CAAC,KAAK,GAAE,MAAU,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAI7E,WAAW,IAAI,MAAM,GAAG,IAAI;IAInC,MAAM;IAgBN,MAAM,CAAC,MAAM,0BAYX;CACL;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,oBAAoB,EAAE,gBAAgB,CAAC;KAC1C;CACJ"}
@@ -0,0 +1,2 @@
1
+ export declare const MONACO_EDITOR_TOOLBAR_TARGET_PREFIX = "toolbar:system.monaco-editor";
2
+ //# sourceMappingURL=monaco-toolbar-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-toolbar-constants.d.ts","sourceRoot":"","sources":["../src/monaco-toolbar-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,iCAAiC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import * as monaco from 'monaco-editor';
3
+ export declare class LyraMonacoWidget extends LitElement {
4
+ value?: string;
5
+ language?: string;
6
+ uri?: string;
7
+ readOnly: boolean;
8
+ theme: string;
9
+ private containerRef;
10
+ private editor?;
11
+ private model?;
12
+ private ensureEditor;
13
+ protected firstUpdated(_changedProperties: PropertyValues): void;
14
+ protected updated(changedProperties: PropertyValues): void;
15
+ disconnectedCallback(): void;
16
+ dispose(): void;
17
+ getEditor(): monaco.editor.IStandaloneCodeEditor | undefined;
18
+ getModel(): monaco.editor.ITextModel | undefined;
19
+ getContent(): string | null;
20
+ getLanguage(): string | null;
21
+ isLanguage(lang: string): boolean;
22
+ getSelection(): string | null;
23
+ getSnippet(lines?: number): {
24
+ snippet: string;
25
+ cursorLine: number;
26
+ } | null;
27
+ render(): import('lit-html').TemplateResult<1>;
28
+ static styles: import('lit').CSSResult;
29
+ }
30
+ declare global {
31
+ interface HTMLElementTagNameMap {
32
+ 'lyra-monaco-widget': LyraMonacoWidget;
33
+ }
34
+ }
35
+ //# sourceMappingURL=monaco-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-widget.d.ts","sourceRoot":"","sources":["../src/monaco-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAsBjD,qBACa,gBAAiB,SAAQ,UAAU;IAE5C,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,OAAO,CAAS;IAG1B,KAAK,EAAE,MAAM,CAAa;IAE1B,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,MAAM,CAAC,CAAsC;IACrD,OAAO,CAAC,KAAK,CAAC,CAA2B;IAEzC,OAAO,CAAC,YAAY;IAkBpB,SAAS,CAAC,YAAY,CAAC,kBAAkB,EAAE,cAAc;IAKzD,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,cAAc;IAOnD,oBAAoB;IAKb,OAAO;IAOP,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,qBAAqB,GAAG,SAAS;IAI5D,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,SAAS;IAIhD,UAAU,IAAI,MAAM,GAAG,IAAI;IAI3B,WAAW,IAAI,MAAM,GAAG,IAAI;IAI5B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,YAAY,IAAI,MAAM,GAAG,IAAI;IAW7B,UAAU,CAAC,KAAK,GAAE,MAAU,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAsBpF,MAAM;IAON,MAAM,CAAC,MAAM,0BAeX;CACL;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,oBAAoB,EAAE,gBAAgB,CAAC;KAC1C;CACJ"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@eclipse-lyra/extension-monaco-editor",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "dependencies": {
13
+ "@eclipse-lyra/core": "*",
14
+ "monaco-editor": "0.55.1"
15
+ },
16
+ "devDependencies": {
17
+ "typescript": "^5.9.3",
18
+ "vite": "^7.1.12",
19
+ "vite-plugin-dts": "^4.5.4"
20
+ },
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "vite build"
28
+ }
29
+ }