@codingame/monaco-vscode-editor-api 15.0.2 → 16.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-editor-api",
3
- "version": "15.0.2",
3
+ "version": "16.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - monaco-editor compatible api",
6
6
  "keywords": [],
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common": "15.0.2",
19
- "@codingame/monaco-vscode-api": "15.0.2"
18
+ "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common": "16.0.0",
19
+ "@codingame/monaco-vscode-api": "16.0.0"
20
20
  },
21
21
  "exports": {
22
22
  ".": "./esm/vs/editor/editor.api.js",
@@ -0,0 +1,42 @@
1
+ .monaco-editor.standalone {
2
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
3
+ --monaco-monospace-font: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
4
+ }
5
+ .monaco-menu .monaco-action-bar.vertical .action-item .action-menu-item:focus .action-label {
6
+ stroke-width: 1.2px;
7
+ }
8
+ .monaco-editor.standalone.vs-dark .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,
9
+ .monaco-editor.standalone.hc-black .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,
10
+ .monaco-editor.standalone.hc-light .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label {
11
+ stroke-width: 1.2px;
12
+ }
13
+ .monaco-hover p {
14
+ margin: 0;
15
+ }
16
+ .monaco-aria-container {
17
+ position: absolute !important;
18
+ top: 0;
19
+ height: 1px;
20
+ width: 1px;
21
+ margin: -1px;
22
+ overflow: hidden;
23
+ padding: 0;
24
+ clip: rect(1px, 1px, 1px, 1px);
25
+ clip-path: inset(50%);
26
+ }
27
+ .monaco-editor.standalone .synthetic-focus, .monaco-diff-editor.standalone .synthetic-focus,
28
+ .monaco-editor.standalone [tabindex="0"]:focus, .monaco-diff-editor.standalone [tabindex="0"]:focus,
29
+ .monaco-editor.standalone [tabindex="-1"]:focus, .monaco-diff-editor.standalone [tabindex="-1"]:focus,
30
+ .monaco-editor.standalone button:focus, .monaco-diff-editor.standalone button:focus,
31
+ .monaco-editor.standalone input[type=button]:focus, .monaco-diff-editor.standalone input[type=button]:focus,
32
+ .monaco-editor.standalone input[type=checkbox]:focus, .monaco-diff-editor.standalone input[type=checkbox]:focus,
33
+ .monaco-editor.standalone input[type=search]:focus, .monaco-diff-editor.standalone input[type=search]:focus,
34
+ .monaco-editor.standalone input[type=text]:focus, .monaco-diff-editor.standalone input[type=text]:focus,
35
+ .monaco-editor.standalone select:focus, .monaco-diff-editor.standalone select:focus,
36
+ .monaco-editor.standalone textarea:focus, .monaco-diff-editor.standalone textarea:focus {
37
+ outline-width: 1px;
38
+ outline-style: solid;
39
+ outline-offset: -1px;
40
+ outline-color: var(--vscode-focusBorder);
41
+ opacity: 1
42
+ }
@@ -1,7 +1,7 @@
1
1
  import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
2
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
3
  import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
4
- import { IWebWorkerOptions, MonacoWebWorker } from "./standaloneWebWorker.js";
4
+ import { IInternalWebWorkerOptions, MonacoWebWorker } from "./standaloneWebWorker.js";
5
5
  import { IPosition } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/position";
6
6
  import { IRange } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range";
7
7
  import { IDiffEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon";
@@ -53,7 +53,7 @@ export declare function onDidChangeModelLanguage(listener: (e: {
53
53
  readonly model: ITextModel;
54
54
  readonly oldLanguage: string;
55
55
  }) => void): IDisposable;
56
- export declare function createWebWorker<T extends object>(opts: IWebWorkerOptions): MonacoWebWorker<T>;
56
+ export declare function createWebWorker<T extends object>(opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
57
57
  export declare function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void>;
58
58
  export declare function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string>;
59
59
  export declare function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize?: number): string;
@@ -3,7 +3,7 @@ import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/
3
3
  import { DisposableStore, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
4
  import { splitLines } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
5
5
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
6
- import './standalone-tokens.css.js';
6
+ import './standalone-tokens.css';
7
7
  import { FontMeasurements } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/config/fontMeasurements';
8
8
  import { EditorCommand } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
9
9
  import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
@@ -1,15 +1,13 @@
1
1
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
2
  import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
3
- export declare function createWebWorker<T extends object>(modelService: IModelService, opts: IWebWorkerOptions): MonacoWebWorker<T>;
3
+ export declare function createWebWorker<T extends object>(modelService: IModelService, opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
4
4
  export interface MonacoWebWorker<T> {
5
5
  dispose(): void;
6
6
  getProxy(): Promise<T>;
7
7
  withSyncedResources(resources: URI[]): Promise<T>;
8
8
  }
9
- export interface IWebWorkerOptions {
10
- moduleId: string;
11
- createData?: any;
12
- label?: string;
9
+ export interface IInternalWebWorkerOptions {
10
+ worker: Worker;
13
11
  host?: any;
14
12
  keepIdleModels?: boolean;
15
13
  }
@@ -1,23 +1,25 @@
1
1
 
2
- import { getAllMethodNames } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
3
2
  import { EditorWorkerClient } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/editorWorkerService';
4
- import { standaloneEditorWorkerDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
5
3
 
6
4
  function createWebWorker(modelService, opts) {
7
5
  return ( new MonacoWebWorkerImpl(modelService, opts));
8
6
  }
9
7
  class MonacoWebWorkerImpl extends EditorWorkerClient {
10
8
  constructor(modelService, opts) {
11
- const workerDescriptor = {
12
- moduleId: standaloneEditorWorkerDescriptor.moduleId,
13
- esmModuleLocation: standaloneEditorWorkerDescriptor.esmModuleLocation,
14
- label: opts.label,
15
- };
16
- super(workerDescriptor, opts.keepIdleModels || false, modelService);
17
- this._foreignModuleId = opts.moduleId;
18
- this._foreignModuleCreateData = opts.createData || null;
9
+ super(opts.worker, opts.keepIdleModels || false, modelService);
19
10
  this._foreignModuleHost = opts.host || null;
20
- this._foreignProxy = null;
11
+ this._foreignProxy = this._getProxy().then(proxy => {
12
+ return ( new Proxy({}, {
13
+ get(target, prop, receiver) {
14
+ if (typeof prop !== 'string') {
15
+ throw ( new Error(`Not supported`));
16
+ }
17
+ return (...args) => {
18
+ return proxy.$fmr(prop, args);
19
+ };
20
+ }
21
+ }));
22
+ });
21
23
  }
22
24
  fhr(method, args) {
23
25
  if (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== 'function') {
@@ -30,33 +32,8 @@ class MonacoWebWorkerImpl extends EditorWorkerClient {
30
32
  return Promise.reject(e);
31
33
  }
32
34
  }
33
- _getForeignProxy() {
34
- if (!this._foreignProxy) {
35
- this._foreignProxy = this._getProxy().then((proxy) => {
36
- const foreignHostMethods = this._foreignModuleHost ? getAllMethodNames(this._foreignModuleHost) : [];
37
- return proxy.$loadForeignModule(this._foreignModuleId, this._foreignModuleCreateData, foreignHostMethods).then((foreignMethods) => {
38
- this._foreignModuleCreateData = null;
39
- const proxyMethodRequest = (method, args) => {
40
- return proxy.$fmr(method, args);
41
- };
42
- const createProxyMethod = (method, proxyMethodRequest) => {
43
- return function () {
44
- const args = Array.prototype.slice.call(arguments, 0);
45
- return proxyMethodRequest(method, args);
46
- };
47
- };
48
- const foreignProxy = {};
49
- for (const foreignMethod of foreignMethods) {
50
- foreignProxy[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest);
51
- }
52
- return foreignProxy;
53
- });
54
- });
55
- }
56
- return this._foreignProxy;
57
- }
58
35
  getProxy() {
59
- return this._getForeignProxy();
36
+ return this._foreignProxy;
60
37
  }
61
38
  withSyncedResources(resources) {
62
39
  return this.workerWithSyncedResources(resources).then(_ => ( this.getProxy()));
@@ -1,6 +0,0 @@
1
- import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
2
-
3
- var css = ".monaco-editor.standalone{--monaco-monospace-font:\"SF Mono\",Monaco,Menlo,Consolas,\"Ubuntu Mono\",\"Liberation Mono\",\"DejaVu Sans Mono\",\"Courier New\",monospace;font-family:-apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,system-ui,Ubuntu,Droid Sans,sans-serif}.monaco-editor.standalone.hc-black .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-editor.standalone.hc-light .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-editor.standalone.vs-dark .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-menu .monaco-action-bar.vertical .action-item .action-menu-item:focus .action-label{stroke-width:1.2px}.monaco-hover p{margin:0}.monaco-aria-container{clip:rect(1px,1px,1px,1px);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;top:0;width:1px}.monaco-diff-editor.standalone .synthetic-focus,.monaco-diff-editor.standalone [tabindex=\"-1\"]:focus,.monaco-diff-editor.standalone [tabindex=\"0\"]:focus,.monaco-diff-editor.standalone button:focus,.monaco-diff-editor.standalone input[type=button]:focus,.monaco-diff-editor.standalone input[type=checkbox]:focus,.monaco-diff-editor.standalone input[type=search]:focus,.monaco-diff-editor.standalone input[type=text]:focus,.monaco-diff-editor.standalone select:focus,.monaco-diff-editor.standalone textarea:focus,.monaco-editor.standalone .synthetic-focus,.monaco-editor.standalone [tabindex=\"-1\"]:focus,.monaco-editor.standalone [tabindex=\"0\"]:focus,.monaco-editor.standalone button:focus,.monaco-editor.standalone input[type=button]:focus,.monaco-editor.standalone input[type=checkbox]:focus,.monaco-editor.standalone input[type=search]:focus,.monaco-editor.standalone input[type=text]:focus,.monaco-editor.standalone select:focus,.monaco-editor.standalone textarea:focus{opacity:1;outline-color:var(--vscode-focusBorder);outline-offset:-1px;outline-style:solid;outline-width:1px}";
4
- n(css,{});
5
-
6
- export { css, css as default };