@eclipse-docks/extension-monaco-editor 0.7.134 → 0.7.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{monaco-editor-extension-CVlRTKeW.js → monaco-editor-extension-DZbEumNV.js} +2 -2
- package/dist/{monaco-editor-extension-CVlRTKeW.js.map → monaco-editor-extension-DZbEumNV.js.map} +1 -1
- package/dist/monaco-grammar-api-4XiCm0-S.js +7 -0
- package/dist/monaco-grammar-api-4XiCm0-S.js.map +1 -0
- package/dist/monaco-grammar-api.d.ts +20 -0
- package/dist/monaco-grammar-api.d.ts.map +1 -0
- package/dist/monaco-grammars.d.ts +7 -0
- package/dist/monaco-grammars.d.ts.map +1 -0
- package/dist/{monaco-widget-CMSTqGnZ.js → monaco-widget-C9CIqaU8.js} +37 -1
- package/dist/monaco-widget-C9CIqaU8.js.map +1 -0
- package/dist/monaco-widget.d.ts.map +1 -1
- package/dist/widget.js +1 -1
- package/package.json +5 -1
- package/dist/monaco-widget-CMSTqGnZ.js.map +0 -1
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC"}
|
package/dist/api.js
ADDED
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,mCAAmC,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,mCAAmC,iCAAiC,CAAC;AAElF,OAAO,EACL,eAAe,EACf,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as MONACO_GRAMMARS } from "./monaco-grammar-api-4XiCm0-S.js";
|
|
1
2
|
import { extensionRegistry, i18n } from "@eclipse-docks/core";
|
|
2
3
|
import pkg from "../package.json";
|
|
3
4
|
//#region src/index.ts
|
|
@@ -9,11 +10,11 @@ extensionRegistry.registerExtension({
|
|
|
9
10
|
id: pkg.name,
|
|
10
11
|
name: t.EXT_MONACO_NAME,
|
|
11
12
|
description: t.EXT_MONACO_DESC,
|
|
12
|
-
loader: () => import("./monaco-editor-extension-
|
|
13
|
+
loader: () => import("./monaco-editor-extension-DZbEumNV.js"),
|
|
13
14
|
icon: "file-pen"
|
|
14
15
|
});
|
|
15
16
|
var MONACO_EDITOR_TOOLBAR_TARGET_PREFIX = "toolbar:system.monaco-editor";
|
|
16
17
|
//#endregion
|
|
17
|
-
export { MONACO_EDITOR_TOOLBAR_TARGET_PREFIX };
|
|
18
|
+
export { MONACO_EDITOR_TOOLBAR_TARGET_PREFIX, MONACO_GRAMMARS };
|
|
18
19
|
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18n } from '@eclipse-docks/core';\nimport pkg from '../package.json';\n\nconst t = await i18n(import.meta.glob('./i18n*.json'), true);\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 const MONACO_EDITOR_TOOLBAR_TARGET_PREFIX = 'toolbar:system.monaco-editor';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18n } from '@eclipse-docks/core';\nimport pkg from '../package.json';\n\nconst t = await i18n(import.meta.glob('./i18n*.json'), true);\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 const MONACO_EDITOR_TOOLBAR_TARGET_PREFIX = 'toolbar:system.monaco-editor';\n\nexport {\n MONACO_GRAMMARS,\n type MonacoGrammarContribution,\n} from './monaco-grammar-api';\n"],"mappings":";;;;AAGA,IAAM,IAAI,MAAM,KAAK,uBAAA,OAAA;CAAA,wBAAA,OAAA;CAAA,wBAAA,OAAA;AAAA,CAAA,GAAkC,IAAI;AAE3D,kBAAkB,kBAAkB;CAClC,IAAI,IAAI;CACR,MAAM,EAAE;CACR,aAAa,EAAE;CACf,cAAc,OAAO;CACrB,MAAM;AACR,CAAC;AAED,IAAa,sCAAsC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./monaco-widget-
|
|
1
|
+
import "./monaco-widget-C9CIqaU8.js";
|
|
2
2
|
import { File, editorRegistry } from "@eclipse-docks/core";
|
|
3
3
|
import { html } from "lit";
|
|
4
4
|
//#region src/monaco-editor-extension.ts
|
|
@@ -25,4 +25,4 @@ editorRegistry.registerEditorInputHandler({
|
|
|
25
25
|
});
|
|
26
26
|
//#endregion
|
|
27
27
|
|
|
28
|
-
//# sourceMappingURL=monaco-editor-extension-
|
|
28
|
+
//# sourceMappingURL=monaco-editor-extension-DZbEumNV.js.map
|
package/dist/{monaco-editor-extension-CVlRTKeW.js.map → monaco-editor-extension-DZbEumNV.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monaco-editor-extension-
|
|
1
|
+
{"version":3,"file":"monaco-editor-extension-DZbEumNV.js","names":[],"sources":["../src/monaco-editor-extension.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { EditorInput, editorRegistry, File } from \"@eclipse-docks/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,\n handle: async (input: File) => {\n const editorInput = {\n title: input.getWorkspacePath(),\n data: input,\n key: input.getWorkspacePath(),\n icon: editorRegistry.getFileIcon(input.getName()),\n state: {},\n } as EditorInput\n editorInput.component = (id: string) => html`\n <docks-monaco-editor id=${id} .input=${editorInput}></docks-monaco-editor>`\n return editorInput;\n }\n})\n"],"mappings":";;;;AAKA,eAAe,2BAA2B;CACtC,UAAU;CACV,OAAO;CACP,MAAM;CACN,UAAU,YAAY;EAClB,MAAM,OAAO;CACjB;CACA,YAAY,UACR,iBAAiB;CACrB,QAAQ,OAAO,UAAgB;EAC3B,MAAM,cAAc;GAChB,OAAO,MAAM,iBAAiB;GAC9B,MAAM;GACN,KAAK,MAAM,iBAAiB;GAC5B,MAAM,eAAe,YAAY,MAAM,QAAQ,CAAC;GAChD,OAAO,CAAC;EACZ;EACA,YAAY,aAAa,OAAe,IAAI;sCACd,GAAG,UAAU,YAAY;EACvD,OAAO;CACX;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/monaco-grammar-api.ts
|
|
2
|
+
/** Contribution target collected by `docks-monaco-widget` before creating models. */
|
|
3
|
+
var MONACO_GRAMMARS = "monaco.grammars";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { MONACO_GRAMMARS as t };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=monaco-grammar-api-4XiCm0-S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-grammar-api-4XiCm0-S.js","names":[],"sources":["../src/monaco-grammar-api.ts"],"sourcesContent":["import type { Contribution } from '@eclipse-docks/core';\nimport type { languages } from 'monaco-editor';\n\n/** Contribution target collected by `docks-monaco-widget` before creating models. */\nexport const MONACO_GRAMMARS = 'monaco.grammars';\n\n/**\n * Register a Monarch grammar for the Monaco instance owned by `docks-monaco-widget`.\n * Extensions must contribute here instead of importing `monaco-editor` directly —\n * a separate import would register against a different Monaco module instance.\n */\nexport interface MonacoGrammarContribution extends Contribution {\n /** Monaco language id (e.g. `lisp`). */\n name: string;\n label: string;\n extensions?: string[];\n aliases?: string[];\n mimetypes?: string[];\n conf?: languages.LanguageConfiguration;\n language: languages.IMonarchLanguage;\n}\n"],"mappings":";;AAIA,IAAa,kBAAkB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Contribution } from '@eclipse-docks/core';
|
|
2
|
+
import { languages } from 'monaco-editor';
|
|
3
|
+
/** Contribution target collected by `docks-monaco-widget` before creating models. */
|
|
4
|
+
export declare const MONACO_GRAMMARS = "monaco.grammars";
|
|
5
|
+
/**
|
|
6
|
+
* Register a Monarch grammar for the Monaco instance owned by `docks-monaco-widget`.
|
|
7
|
+
* Extensions must contribute here instead of importing `monaco-editor` directly —
|
|
8
|
+
* a separate import would register against a different Monaco module instance.
|
|
9
|
+
*/
|
|
10
|
+
export interface MonacoGrammarContribution extends Contribution {
|
|
11
|
+
/** Monaco language id (e.g. `lisp`). */
|
|
12
|
+
name: string;
|
|
13
|
+
label: string;
|
|
14
|
+
extensions?: string[];
|
|
15
|
+
aliases?: string[];
|
|
16
|
+
mimetypes?: string[];
|
|
17
|
+
conf?: languages.LanguageConfiguration;
|
|
18
|
+
language: languages.IMonarchLanguage;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=monaco-grammar-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-grammar-api.d.ts","sourceRoot":"","sources":["../src/monaco-grammar-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,qFAAqF;AACrF,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,YAAY;IAC7D,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC,qBAAqB,CAAC;IACvC,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC;CACtC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply contributed Monarch grammars to this package's Monaco module.
|
|
3
|
+
* Safe to call repeatedly; each language id is registered at most once.
|
|
4
|
+
*/
|
|
5
|
+
export declare function ensureContributedGrammars(): void;
|
|
6
|
+
export declare function watchContributedGrammars(): void;
|
|
7
|
+
//# sourceMappingURL=monaco-grammars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-grammars.d.ts","sourceRoot":"","sources":["../src/monaco-grammars.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAwBhD;AAID,wBAAgB,wBAAwB,IAAI,IAAI,CAO/C"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { a as Uri, c as languages, l as __exportAll, n as MarkerSeverity, o as editor, r as MarkerTag, s as editor_api2_exports, t as Emitter } from "./editor.api2-BZ1qaMAz.js";
|
|
2
|
+
import { t as MONACO_GRAMMARS } from "./monaco-grammar-api-4XiCm0-S.js";
|
|
2
3
|
import { t as monaco_contribution_exports$3 } from "./monaco.contribution-faB-d0OZ.js";
|
|
3
4
|
import "./workers-CvauEILg.js";
|
|
5
|
+
import { TOPIC_CONTRIBUTEIONS_CHANGED, contributionRegistry, subscribe } from "@eclipse-docks/core";
|
|
4
6
|
import { customElement, property } from "lit/decorators.js";
|
|
5
7
|
import { LitElement, css, html } from "lit";
|
|
6
8
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
@@ -2598,6 +2600,38 @@ function WorkerWrapper(options) {
|
|
|
2598
2600
|
return new Worker("/assets/ts.worker-C3DemgJl.js", { name: options?.name });
|
|
2599
2601
|
}
|
|
2600
2602
|
//#endregion
|
|
2603
|
+
//#region src/monaco-grammars.ts
|
|
2604
|
+
var appliedGrammarIds = /* @__PURE__ */ new Set();
|
|
2605
|
+
/**
|
|
2606
|
+
* Apply contributed Monarch grammars to this package's Monaco module.
|
|
2607
|
+
* Safe to call repeatedly; each language id is registered at most once.
|
|
2608
|
+
*/
|
|
2609
|
+
function ensureContributedGrammars() {
|
|
2610
|
+
const contributions = contributionRegistry.getContributions(MONACO_GRAMMARS);
|
|
2611
|
+
for (const contribution of contributions) {
|
|
2612
|
+
const id = contribution.name;
|
|
2613
|
+
if (!id || appliedGrammarIds.has(id)) continue;
|
|
2614
|
+
if (!languages.getLanguages().some((lang) => lang.id === id)) languages.register({
|
|
2615
|
+
id,
|
|
2616
|
+
extensions: contribution.extensions,
|
|
2617
|
+
aliases: contribution.aliases,
|
|
2618
|
+
mimetypes: contribution.mimetypes
|
|
2619
|
+
});
|
|
2620
|
+
if (contribution.conf) languages.setLanguageConfiguration(id, contribution.conf);
|
|
2621
|
+
languages.setMonarchTokensProvider(id, contribution.language);
|
|
2622
|
+
appliedGrammarIds.add(id);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
var listening = false;
|
|
2626
|
+
function watchContributedGrammars() {
|
|
2627
|
+
if (listening) return;
|
|
2628
|
+
listening = true;
|
|
2629
|
+
subscribe(TOPIC_CONTRIBUTEIONS_CHANGED, (event) => {
|
|
2630
|
+
if (event.target !== "monaco.grammars") return;
|
|
2631
|
+
ensureContributedGrammars();
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
//#endregion
|
|
2601
2635
|
//#region src/monaco-widget.ts
|
|
2602
2636
|
function getMonacoWorker(_, label) {
|
|
2603
2637
|
switch (label) {
|
|
@@ -2614,6 +2648,7 @@ function getMonacoWorker(_, label) {
|
|
|
2614
2648
|
}
|
|
2615
2649
|
}
|
|
2616
2650
|
self.MonacoEnvironment = { getWorker: getMonacoWorker };
|
|
2651
|
+
watchContributedGrammars();
|
|
2617
2652
|
var DocksMonacoWidget = class DocksMonacoWidget extends LitElement {
|
|
2618
2653
|
constructor(..._args) {
|
|
2619
2654
|
super(..._args);
|
|
@@ -2647,6 +2682,7 @@ var DocksMonacoWidget = class DocksMonacoWidget extends LitElement {
|
|
|
2647
2682
|
const container = this.containerRef.value;
|
|
2648
2683
|
if (!container || this.editor) return;
|
|
2649
2684
|
if (this.value === void 0) return;
|
|
2685
|
+
ensureContributedGrammars();
|
|
2650
2686
|
const uri = this.uri != null ? Uri.file(this.uri) : void 0;
|
|
2651
2687
|
this.model = editor.createModel(this.value, this.language, uri);
|
|
2652
2688
|
this.editor = editor.create(container, {
|
|
@@ -2804,4 +2840,4 @@ DocksMonacoWidget = _decorate([customElement("docks-monaco-widget")], DocksMonac
|
|
|
2804
2840
|
//#endregion
|
|
2805
2841
|
export { DocksMonacoWidget as t };
|
|
2806
2842
|
|
|
2807
|
-
//# sourceMappingURL=monaco-widget-
|
|
2843
|
+
//# sourceMappingURL=monaco-widget-C9CIqaU8.js.map
|