@eclipse-glsp/vscode-integration-webview 1.1.0-next.ef526c6.51 → 2.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.
Files changed (89) hide show
  1. package/README.md +1 -1
  2. package/lib/default-modules.d.ts +19 -0
  3. package/lib/default-modules.d.ts.map +1 -0
  4. package/lib/default-modules.js +34 -0
  5. package/lib/default-modules.js.map +1 -0
  6. package/lib/diagram-identifier.d.ts +14 -0
  7. package/lib/diagram-identifier.d.ts.map +1 -0
  8. package/lib/{diagram-identifer.js → diagram-identifier.js} +11 -5
  9. package/lib/diagram-identifier.js.map +1 -0
  10. package/lib/{copy-paste-handler-provider.js → features/copyPaste/copy-paste-module.d.ts} +4 -6
  11. package/lib/features/copyPaste/copy-paste-module.d.ts.map +1 -0
  12. package/lib/features/copyPaste/copy-paste-module.js +28 -0
  13. package/lib/features/copyPaste/copy-paste-module.js.map +1 -0
  14. package/lib/{copy-paste-handler-provider.d.ts → features/copyPaste/copy-paste-startup.d.ts} +10 -3
  15. package/lib/features/copyPaste/copy-paste-startup.d.ts.map +1 -0
  16. package/lib/{glsp-vscode-diagram-widget.js → features/copyPaste/copy-paste-startup.js} +37 -32
  17. package/lib/features/copyPaste/copy-paste-startup.js.map +1 -0
  18. package/lib/{diagram-identifer.d.ts → features/default/default-module.d.ts} +4 -11
  19. package/lib/features/default/default-module.d.ts.map +1 -0
  20. package/lib/features/default/default-module.js +31 -0
  21. package/lib/features/default/default-module.js.map +1 -0
  22. package/lib/{extension-action-handler.d.ts → features/default/extension-action-handler.d.ts} +18 -11
  23. package/lib/features/default/extension-action-handler.d.ts.map +1 -0
  24. package/lib/features/default/extension-action-handler.js +85 -0
  25. package/lib/features/default/extension-action-handler.js.map +1 -0
  26. package/lib/features/default/vscode-glsp-modelsource.d.ts +40 -0
  27. package/lib/features/default/vscode-glsp-modelsource.d.ts.map +1 -0
  28. package/lib/features/default/vscode-glsp-modelsource.js +68 -0
  29. package/lib/features/default/vscode-glsp-modelsource.js.map +1 -0
  30. package/lib/features/export/export-module.d.ts +18 -0
  31. package/lib/features/export/export-module.d.ts.map +1 -0
  32. package/lib/features/export/export-module.js +24 -0
  33. package/lib/features/export/export-module.js.map +1 -0
  34. package/lib/features/navigation/navigation-module.d.ts +18 -0
  35. package/lib/features/navigation/navigation-module.d.ts.map +1 -0
  36. package/lib/features/navigation/navigation-module.js +24 -0
  37. package/lib/features/navigation/navigation-module.js.map +1 -0
  38. package/lib/features/notification/notification-module.d.ts +18 -0
  39. package/lib/features/notification/notification-module.d.ts.map +1 -0
  40. package/lib/features/notification/notification-module.js +27 -0
  41. package/lib/features/notification/notification-module.js.map +1 -0
  42. package/lib/glsp-diagram-widget.d.ts +32 -0
  43. package/lib/glsp-diagram-widget.d.ts.map +1 -0
  44. package/lib/glsp-diagram-widget.js +89 -0
  45. package/lib/glsp-diagram-widget.js.map +1 -0
  46. package/lib/glsp-starter.d.ts +43 -9
  47. package/lib/glsp-starter.d.ts.map +1 -1
  48. package/lib/glsp-starter.js +53 -66
  49. package/lib/glsp-starter.js.map +1 -1
  50. package/lib/index.d.ts +12 -2
  51. package/lib/index.d.ts.map +1 -1
  52. package/lib/index.js +26 -16
  53. package/lib/index.js.map +1 -1
  54. package/lib/webview-glsp-client.d.ts +56 -0
  55. package/lib/webview-glsp-client.d.ts.map +1 -0
  56. package/lib/webview-glsp-client.js +103 -0
  57. package/lib/webview-glsp-client.js.map +1 -0
  58. package/package.json +15 -15
  59. package/src/default-modules.ts +34 -0
  60. package/src/{diagram-identifer.ts → diagram-identifier.ts} +16 -5
  61. package/src/features/copyPaste/copy-paste-module.ts +39 -0
  62. package/src/features/copyPaste/copy-paste-startup.ts +50 -0
  63. package/src/features/default/default-module.ts +32 -0
  64. package/src/features/default/extension-action-handler.ts +73 -0
  65. package/src/features/default/vscode-glsp-modelsource.ts +63 -0
  66. package/src/{copy-paste-handler-provider.ts → features/export/export-module.ts} +6 -8
  67. package/src/features/navigation/navigation-module.ts +22 -0
  68. package/src/features/notification/notification-module.ts +25 -0
  69. package/src/glsp-diagram-widget.ts +79 -0
  70. package/src/glsp-starter.ts +69 -85
  71. package/src/index.ts +13 -2
  72. package/src/webview-glsp-client.ts +132 -0
  73. package/lib/copy-paste-handler-provider.d.ts.map +0 -1
  74. package/lib/copy-paste-handler-provider.js.map +0 -1
  75. package/lib/diagram-identifer.d.ts.map +0 -1
  76. package/lib/diagram-identifer.js.map +0 -1
  77. package/lib/extension-action-handler.d.ts.map +0 -1
  78. package/lib/extension-action-handler.js +0 -30
  79. package/lib/extension-action-handler.js.map +0 -1
  80. package/lib/glsp-vscode-diagram-widget.d.ts +0 -6
  81. package/lib/glsp-vscode-diagram-widget.d.ts.map +0 -1
  82. package/lib/glsp-vscode-diagram-widget.js.map +0 -1
  83. package/lib/glsp-vscode-diagramserver.d.ts +0 -33
  84. package/lib/glsp-vscode-diagramserver.d.ts.map +0 -1
  85. package/lib/glsp-vscode-diagramserver.js +0 -108
  86. package/lib/glsp-vscode-diagramserver.js.map +0 -1
  87. package/src/extension-action-handler.ts +0 -46
  88. package/src/glsp-vscode-diagram-widget.ts +0 -42
  89. package/src/glsp-vscode-diagramserver.ts +0 -111
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
package/lib/index.js CHANGED
@@ -1,4 +1,19 @@
1
1
  "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2020-2023 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
2
17
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
18
  if (k2 === undefined) k2 = k;
4
19
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -14,21 +29,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
29
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
30
  };
16
31
  Object.defineProperty(exports, "__esModule", { value: true });
17
- /********************************************************************************
18
- * Copyright (c) 2020 EclipseSource and others.
19
- *
20
- * This program and the accompanying materials are made available under the
21
- * terms of the Eclipse Public License v. 2.0 which is available at
22
- * http://www.eclipse.org/legal/epl-2.0.
23
- *
24
- * This Source Code may also be made available under the following Secondary
25
- * Licenses when the conditions for such availability set forth in the Eclipse
26
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
27
- * with the GNU Classpath Exception which is available at
28
- * https://www.gnu.org/software/classpath/license.html.
29
- *
30
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
31
- ********************************************************************************/
32
+ __exportStar(require("./default-modules"), exports);
33
+ __exportStar(require("./diagram-identifier"), exports);
34
+ __exportStar(require("./features/copyPaste/copy-paste-module"), exports);
35
+ __exportStar(require("./features/copyPaste/copy-paste-startup"), exports);
36
+ __exportStar(require("./features/default/default-module"), exports);
37
+ __exportStar(require("./features/default/vscode-glsp-modelsource"), exports);
38
+ __exportStar(require("./features/export/export-module"), exports);
39
+ __exportStar(require("./features/navigation/navigation-module"), exports);
40
+ __exportStar(require("./features/notification/notification-module"), exports);
41
+ __exportStar(require("./glsp-diagram-widget"), exports);
32
42
  __exportStar(require("./glsp-starter"), exports);
33
- __exportStar(require("./glsp-vscode-diagramserver"), exports);
43
+ __exportStar(require("./webview-glsp-client"), exports);
34
44
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAA+B;AAC/B,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;;AAElF,oDAAkC;AAClC,uDAAqC;AACrC,yEAAuD;AACvD,0EAAwD;AACxD,oEAAkD;AAClD,6EAA2D;AAC3D,kEAAgD;AAChD,0EAAwD;AACxD,8EAA4D;AAC5D,wDAAsC;AACtC,iDAA+B;AAC/B,wDAAsC"}
@@ -0,0 +1,56 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, ActionMessage, ActionMessageHandler, ClientState, Disposable, DisposableCollection, DisposeClientSessionParameters, Emitter, Event, GLSPClient, InitializeClientSessionParameters, InitializeParameters, InitializeResult } from '@eclipse-glsp/client';
17
+ import { NotificationType, RequestType } from 'vscode-messenger-common';
18
+ import { Messenger } from 'vscode-messenger-webview';
19
+ export interface WebviewGlspClientOptions extends GLSPClient.Options {
20
+ messenger?: Messenger;
21
+ }
22
+ export declare const ActionMessageNotification: NotificationType<ActionMessage>;
23
+ export declare const StartRequest: RequestType<undefined, void>;
24
+ export declare const InitializeServerRequest: RequestType<InitializeParameters, InitializeResult>;
25
+ export declare const InitializeClientSessionRequest: RequestType<InitializeClientSessionParameters, void>;
26
+ export declare const DisposeClientSessionRequest: RequestType<DisposeClientSessionParameters, void>;
27
+ export declare const ShutdownServerNotification: NotificationType<void>;
28
+ export declare const StopRequest: RequestType<undefined, void>;
29
+ /**
30
+ * GLSP client implementation for the diagram webview. This is proxy implementation
31
+ * that communicates with the actual GLSP client running in the host extension.
32
+ * via the vscode-messenger protocol
33
+ */
34
+ export declare class WebviewGlspClient implements GLSPClient, Disposable {
35
+ readonly id: string;
36
+ protected messenger: Messenger;
37
+ protected toDispose: DisposableCollection;
38
+ protected onActionMessageEmitter: Emitter<ActionMessage<Action>>;
39
+ protected _currentState: ClientState;
40
+ get currentState(): ClientState;
41
+ protected _initializeResult?: InitializeResult;
42
+ get initializeResult(): InitializeResult | undefined;
43
+ protected onServerInitializedEmitter: Emitter<InitializeResult>;
44
+ get onServerInitialized(): Event<InitializeResult>;
45
+ constructor(options: WebviewGlspClientOptions);
46
+ start(): Promise<void>;
47
+ initializeServer(params: InitializeParameters): Promise<InitializeResult>;
48
+ initializeClientSession(params: InitializeClientSessionParameters): Promise<void>;
49
+ disposeClientSession(params: DisposeClientSessionParameters): Promise<void>;
50
+ shutdownServer(): void;
51
+ stop(): Promise<void>;
52
+ sendActionMessage(message: ActionMessage<Action>): void;
53
+ onActionMessage(handler: ActionMessageHandler): Disposable;
54
+ dispose(): void;
55
+ }
56
+ //# sourceMappingURL=webview-glsp-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webview-glsp-client.d.ts","sourceRoot":"","sources":["../src/webview-glsp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EACN,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,OAAO,EACP,KAAK,EACL,UAAU,EACV,iCAAiC,EACjC,oBAAoB,EACpB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAkB,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,WAAW,wBAAyB,SAAQ,UAAU,CAAC,OAAO;IAChE,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,eAAO,MAAM,yBAAyB,EAAE,gBAAgB,CAAC,aAAa,CAA+B,CAAC;AACtG,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,SAAS,EAAE,IAAI,CAAuB,CAAC;AAC9E,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,oBAAoB,EAAE,gBAAgB,CAAkC,CAAC;AAC3H,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,iCAAiC,EAAE,IAAI,CAAyC,CAAC;AAC1I,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,8BAA8B,EAAE,IAAI,CAAsC,CAAC;AACjI,eAAO,MAAM,0BAA0B,EAAE,gBAAgB,CAAC,IAAI,CAAgC,CAAC;AAC/F,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,SAAS,EAAE,IAAI,CAAsB,CAAC;AAC5E;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,UAAU,EAAE,UAAU;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAC/B,SAAS,CAAC,SAAS,uBAA8B;IACjD,SAAS,CAAC,sBAAsB,iCAAgC;IAEhE,SAAS,CAAC,aAAa,EAAE,WAAW,CAAwB;IAC5D,IAAI,YAAY,IAAI,WAAW,CAE9B;IAED,SAAS,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IAC/C,IAAI,gBAAgB,IAAI,gBAAgB,GAAG,SAAS,CAEnD;IAED,SAAS,CAAC,0BAA0B,4BAAmC;IACvE,IAAI,mBAAmB,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAEjD;gBAEW,OAAO,EAAE,wBAAwB;IAOvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtB,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU/E,uBAAuB,CAAC,MAAM,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF,oBAAoB,CAAC,MAAM,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,cAAc,IAAI,IAAI;IAIhB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B,iBAAiB,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI;IAIvD,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,UAAU;IAI1D,OAAO,IAAI,IAAI;CAGlB"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2023 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.WebviewGlspClient = exports.StopRequest = exports.ShutdownServerNotification = exports.DisposeClientSessionRequest = exports.InitializeClientSessionRequest = exports.InitializeServerRequest = exports.StartRequest = exports.ActionMessageNotification = void 0;
19
+ const client_1 = require("@eclipse-glsp/client");
20
+ const vscode_messenger_common_1 = require("vscode-messenger-common");
21
+ const vscode_messenger_webview_1 = require("vscode-messenger-webview");
22
+ exports.ActionMessageNotification = { method: 'actionMessage' };
23
+ exports.StartRequest = { method: 'start' };
24
+ exports.InitializeServerRequest = { method: 'initializeServer' };
25
+ exports.InitializeClientSessionRequest = { method: 'initializeClientSession' };
26
+ exports.DisposeClientSessionRequest = { method: 'disposeClientSession' };
27
+ exports.ShutdownServerNotification = { method: 'shutdownServer' };
28
+ exports.StopRequest = { method: 'stop' };
29
+ /**
30
+ * GLSP client implementation for the diagram webview. This is proxy implementation
31
+ * that communicates with the actual GLSP client running in the host extension.
32
+ * via the vscode-messenger protocol
33
+ */
34
+ class WebviewGlspClient {
35
+ get currentState() {
36
+ return this._currentState;
37
+ }
38
+ get initializeResult() {
39
+ return this._initializeResult;
40
+ }
41
+ get onServerInitialized() {
42
+ return this.onServerInitializedEmitter.event;
43
+ }
44
+ constructor(options) {
45
+ var _a;
46
+ this.toDispose = new client_1.DisposableCollection();
47
+ this.onActionMessageEmitter = new client_1.Emitter();
48
+ this._currentState = client_1.ClientState.Starting;
49
+ this.onServerInitializedEmitter = new client_1.Emitter();
50
+ this.id = options.id;
51
+ this.messenger = (_a = options.messenger) !== null && _a !== void 0 ? _a : new vscode_messenger_webview_1.Messenger();
52
+ this.toDispose.push(this.onActionMessageEmitter, this.onServerInitializedEmitter);
53
+ this.messenger.onNotification(exports.ActionMessageNotification, msg => this.onActionMessageEmitter.fire(msg));
54
+ }
55
+ async start() {
56
+ try {
57
+ this._currentState = client_1.ClientState.Starting;
58
+ await this.messenger.sendRequest(exports.StartRequest, vscode_messenger_common_1.HOST_EXTENSION);
59
+ this._currentState = client_1.ClientState.Running;
60
+ }
61
+ catch (error) {
62
+ console.error('Failed to start connection to server', error);
63
+ this._currentState = client_1.ClientState.StartFailed;
64
+ }
65
+ }
66
+ async initializeServer(params) {
67
+ if (this.initializeResult) {
68
+ return this.initializeResult;
69
+ }
70
+ const result = await this.messenger.sendRequest(exports.InitializeServerRequest, vscode_messenger_common_1.HOST_EXTENSION, params);
71
+ this._initializeResult = result;
72
+ this.onServerInitializedEmitter.fire(result);
73
+ return result;
74
+ }
75
+ initializeClientSession(params) {
76
+ return this.messenger.sendRequest(exports.InitializeClientSessionRequest, vscode_messenger_common_1.HOST_EXTENSION, params);
77
+ }
78
+ disposeClientSession(params) {
79
+ return this.messenger.sendRequest(exports.DisposeClientSessionRequest, vscode_messenger_common_1.HOST_EXTENSION, params);
80
+ }
81
+ shutdownServer() {
82
+ this.messenger.sendNotification(exports.ShutdownServerNotification, vscode_messenger_common_1.HOST_EXTENSION);
83
+ }
84
+ async stop() {
85
+ if (this._currentState === client_1.ClientState.Stopped) {
86
+ return;
87
+ }
88
+ this._currentState = client_1.ClientState.Stopping;
89
+ await this.messenger.sendRequest(exports.StopRequest, vscode_messenger_common_1.HOST_EXTENSION);
90
+ this._currentState = client_1.ClientState.Stopped;
91
+ }
92
+ sendActionMessage(message) {
93
+ this.messenger.sendNotification(exports.ActionMessageNotification, vscode_messenger_common_1.HOST_EXTENSION, message);
94
+ }
95
+ onActionMessage(handler) {
96
+ return this.onActionMessageEmitter.event(handler);
97
+ }
98
+ dispose() {
99
+ this.toDispose.dispose();
100
+ }
101
+ }
102
+ exports.WebviewGlspClient = WebviewGlspClient;
103
+ //# sourceMappingURL=webview-glsp-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webview-glsp-client.js","sourceRoot":"","sources":["../src/webview-glsp-client.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/vscode-integration-webview",
3
- "version": "1.1.0-next.ef526c6.51+ef526c6",
3
+ "version": "2.0.0",
4
4
  "description": "Integration of a GLSP diagram in a VS Code extensions (WebView part)",
5
- "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
6
5
  "keywords": [
7
6
  "vscode",
8
7
  "graph",
@@ -12,13 +11,14 @@
12
11
  ],
13
12
  "homepage": "https://www.eclipse.org/glsp/",
14
13
  "bugs": "https://github.com/eclipse-glsp/glsp/issues",
15
- "author": {
16
- "name": "Eclipse GLSP"
17
- },
18
14
  "repository": {
19
15
  "type": "git",
20
16
  "url": "https://github.com/eclipse-glsp/glsp-vscode-integration.git"
21
17
  },
18
+ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
19
+ "author": {
20
+ "name": "Eclipse GLSP"
21
+ },
22
22
  "contributors": [
23
23
  {
24
24
  "name": "Eclipse GLSP Project",
@@ -26,18 +26,13 @@
26
26
  "url": "https://projects.eclipse.org/projects/ecd.glsp"
27
27
  }
28
28
  ],
29
+ "main": "lib/index",
30
+ "types": "lib/index",
29
31
  "files": [
30
32
  "lib",
31
33
  "src",
32
34
  "css"
33
35
  ],
34
- "dependencies": {
35
- "@eclipse-glsp/client": "next",
36
- "sprotty-vscode-webview": "~0.3.1"
37
- },
38
- "devDependencies": {
39
- "reflect-metadata": "^0.1.13"
40
- },
41
36
  "scripts": {
42
37
  "build": "tsc -b",
43
38
  "clean": "rimraf lib tsconfig.tsbuildinfo ",
@@ -46,10 +41,15 @@
46
41
  "prepare": "yarn clean && yarn build",
47
42
  "watch": "tsc -w"
48
43
  },
44
+ "dependencies": {
45
+ "@eclipse-glsp/client": "~2.0.0",
46
+ "vscode-messenger-webview": "^0.4.5"
47
+ },
48
+ "devDependencies": {
49
+ "reflect-metadata": "^0.1.13"
50
+ },
49
51
  "publishConfig": {
50
52
  "access": "public"
51
53
  },
52
- "main": "lib/index",
53
- "types": "lib/index",
54
- "gitHead": "ef526c6858c979edc16f8e201047399eb5365428"
54
+ "gitHead": "4c8ff9c423f7c867b8d39fb94a25f9ac1e6bdff8"
55
55
  }
@@ -0,0 +1,34 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { ModuleConfiguration } from '@eclipse-glsp/client';
18
+ import { vscodeCopyPasteModule } from './features/copyPaste/copy-paste-module';
19
+ import { vscodeDefaultModule } from './features/default/default-module';
20
+ import { vscodeExportModule } from './features/export/export-module';
21
+ import { vscodeNavigationModule } from './features/navigation/navigation-module';
22
+ import { vscodeNotificationModule } from './features/notification/notification-module';
23
+
24
+ export const VSCODE_DEFAULT_MODULES = [
25
+ vscodeDefaultModule,
26
+ vscodeCopyPasteModule,
27
+ vscodeExportModule,
28
+ vscodeNavigationModule,
29
+ vscodeNotificationModule
30
+ ] as const;
31
+
32
+ export const VSCODE_DEFAULT_MODULE_CONFIG: ModuleConfiguration = {
33
+ add: [...VSCODE_DEFAULT_MODULES]
34
+ };
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021-2022 EclipseSource and others.
2
+ * Copyright (c) 2021-2023 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { hasStringProp, InitializeResult } from '@eclipse-glsp/client';
16
+ import { AnyObject, hasStringProp } from '@eclipse-glsp/client';
17
17
 
18
18
  export const GLSPDiagramIdentifier = Symbol('GLSPDiagramIdentifier');
19
19
 
@@ -21,15 +21,26 @@ export interface GLSPDiagramIdentifier {
21
21
  clientId: string;
22
22
  diagramType: string;
23
23
  uri: string;
24
- initializeResult?: InitializeResult;
25
24
  }
26
25
 
27
26
  export function isDiagramIdentifier(object: any): object is GLSPDiagramIdentifier {
28
27
  return (
29
- object !== undefined &&
30
- typeof object === 'object' &&
28
+ AnyObject.is(object) && //
31
29
  hasStringProp(object, 'clientId') &&
32
30
  hasStringProp(object, 'diagramType') &&
33
31
  hasStringProp(object, 'uri')
34
32
  );
35
33
  }
34
+
35
+ // ----------------------------------
36
+ // Initial Handshake
37
+
38
+ export interface WebviewReadyMessage {
39
+ readyMessage: string;
40
+ }
41
+
42
+ export namespace WebviewReadyMessage {
43
+ export function is(object: unknown): object is WebviewReadyMessage {
44
+ return AnyObject.is(object) && hasStringProp(object, 'readyMessage');
45
+ }
46
+ }
@@ -0,0 +1,39 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import {
18
+ FeatureModule,
19
+ ICopyPasteHandler,
20
+ RequestClipboardDataAction,
21
+ SetClipboardDataAction,
22
+ TYPES,
23
+ bindAsService,
24
+ copyPasteModule
25
+ } from '@eclipse-glsp/client';
26
+ import { ExtensionActionKind } from '../default/extension-action-handler';
27
+ import { CopyPasteHandlerProvider, CopyPasteStartup } from './copy-paste-startup';
28
+
29
+ export const vscodeCopyPasteModule = new FeatureModule(
30
+ bind => {
31
+ bind(CopyPasteHandlerProvider).toProvider(
32
+ ctx => () => new Promise<ICopyPasteHandler>(resolve => resolve(ctx.container.get<ICopyPasteHandler>(TYPES.ICopyPasteHandler)))
33
+ );
34
+ bindAsService(bind, TYPES.IDiagramStartup, CopyPasteStartup);
35
+ bind(ExtensionActionKind).toConstantValue(RequestClipboardDataAction.KIND);
36
+ bind(ExtensionActionKind).toConstantValue(SetClipboardDataAction.KIND);
37
+ },
38
+ { requires: copyPasteModule }
39
+ );
@@ -0,0 +1,50 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { ICopyPasteHandler, IDiagramStartup, MaybePromise } from '@eclipse-glsp/client';
18
+ import { inject, injectable } from 'inversify';
19
+
20
+ export const CopyPasteHandlerProvider = Symbol('CopyPasteHandlerProvider');
21
+ /**
22
+ * Service identifier and type definition to bind the {@link ICopyPasteHandler} to an provider.
23
+ * This enables asynchronous injections and can be used to bypass circular dependency issues.
24
+ */
25
+ export type CopyPasteHandlerProvider = () => Promise<ICopyPasteHandler>;
26
+
27
+ /**
28
+ * Startup service to hook up the copy&paste event handler
29
+ */
30
+ @injectable()
31
+ export class CopyPasteStartup implements IDiagramStartup {
32
+ @inject(CopyPasteHandlerProvider)
33
+ protected copyPasteHandlerProvider: CopyPasteHandlerProvider;
34
+
35
+ preInitialize(): MaybePromise<void> {
36
+ this.copyPasteHandlerProvider().then(copyPasteHandler => {
37
+ document.addEventListener('copy', (e: ClipboardEvent) => {
38
+ copyPasteHandler.handleCopy(e);
39
+ });
40
+
41
+ document.addEventListener('cut', (e: ClipboardEvent) => {
42
+ copyPasteHandler.handleCut(e);
43
+ });
44
+
45
+ document.addEventListener('paste', (e: ClipboardEvent) => {
46
+ copyPasteHandler.handlePaste(e);
47
+ });
48
+ });
49
+ }
50
+ }
@@ -0,0 +1,32 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { FeatureModule, GLSPModelSource, SelectAction, TYPES, bindAsService, defaultModule } from '@eclipse-glsp/client';
18
+ import { GLSPDiagramWidget, GLSPDiagramWidgetFactory } from '../../glsp-diagram-widget';
19
+ import { ExtensionActionKind, HostExtensionActionHandler } from './extension-action-handler';
20
+ import { VsCodeGLSPModelSource } from './vscode-glsp-modelsource';
21
+
22
+ export const vscodeDefaultModule = new FeatureModule(
23
+ (bind, _unbind, _isBound, rebind) => {
24
+ bind(GLSPDiagramWidget).toSelf().inSingletonScope();
25
+ bind(GLSPDiagramWidgetFactory).toFactory(context => () => context.container.get<GLSPDiagramWidget>(GLSPDiagramWidget));
26
+ bind(VsCodeGLSPModelSource).toSelf().inSingletonScope();
27
+ rebind(GLSPModelSource).toService(VsCodeGLSPModelSource);
28
+ bindAsService(bind, TYPES.IActionHandlerInitializer, HostExtensionActionHandler);
29
+ bind(ExtensionActionKind).toConstantValue(SelectAction.KIND);
30
+ },
31
+ { requires: defaultModule }
32
+ );
@@ -0,0 +1,73 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2021-2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import {
17
+ Action,
18
+ ActionHandlerRegistry,
19
+ GLSPClient,
20
+ IActionHandler,
21
+ IActionHandlerInitializer,
22
+ ICommand,
23
+ IDiagramOptions,
24
+ TYPES
25
+ } from '@eclipse-glsp/client';
26
+ import { inject, injectable, multiInject, optional, postConstruct } from 'inversify';
27
+
28
+ /**
29
+ * Service identifier to define action kinds that should be delegated to the vscode extension (when locally dispatched)
30
+ *
31
+ * Usage:
32
+ * ```ts
33
+ * bind(ExtensionActionKind).toConstantValue(SomeAction.KIND)
34
+ * ```
35
+ */
36
+ export const ExtensionActionKind = Symbol('ExtensionActionKind');
37
+
38
+ /**
39
+ * Delegates actions that should be handled inside of the host extension instead
40
+ * of the webview. This enables the implementation of action handlers that require access
41
+ * to the vscode API.
42
+ */
43
+ @injectable()
44
+ export class HostExtensionActionHandler implements IActionHandler, IActionHandlerInitializer {
45
+ @multiInject(ExtensionActionKind)
46
+ @optional()
47
+ protected actionKinds: string[] = [];
48
+
49
+ @inject(TYPES.IDiagramOptions)
50
+ protected diagramOptions: IDiagramOptions;
51
+
52
+ protected glspClient?: GLSPClient;
53
+
54
+ @postConstruct()
55
+ protected postConstruct(): void {
56
+ this.diagramOptions.glspClientProvider().then(glspClient => (this.glspClient = glspClient));
57
+ }
58
+
59
+ initialize(registry: ActionHandlerRegistry): void {
60
+ this.actionKinds.forEach(kind => registry.register(kind, this));
61
+ }
62
+
63
+ handle(action: Action): void | Action | ICommand {
64
+ if (this.actionKinds.includes(action.kind)) {
65
+ const message = {
66
+ clientId: this.diagramOptions.clientId,
67
+ action,
68
+ __localDispatch: true
69
+ };
70
+ this.glspClient?.sendActionMessage(message);
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,63 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, ActionMessage, GLSPModelSource, ServerAction } from '@eclipse-glsp/client';
17
+ import { injectable } from 'inversify';
18
+
19
+ /**
20
+ * A helper interface that allows the webview to mark actions that have been received directly from the vscode extension
21
+ * (i.e. they are not forwarded to the GLSP Server).
22
+ */
23
+ export interface ExtensionAction extends Action {
24
+ __localDispatch: true;
25
+ }
26
+
27
+ export namespace ExtensionAction {
28
+ export function is(object: unknown): object is ExtensionAction {
29
+ return Action.is(object) && '__localDispatch' in object && object.__localDispatch === true;
30
+ }
31
+
32
+ /**
33
+ * Mark the given action as {@link ServerAction} by attaching the "_receivedFromServer" property
34
+ * @param action The action that should be marked as server action
35
+ */
36
+ export function mark(action: Action): void {
37
+ (action as ExtensionAction).__localDispatch = true;
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Customization of the default {@link GLSPModelSource} for the vscode integration.
43
+ * Also takes locally dispatched actions (i.e. actions that are originating from or intended for the host extension) into consideration.
44
+ */
45
+ @injectable()
46
+ export class VsCodeGLSPModelSource extends GLSPModelSource {
47
+ protected override messageReceived(message: ActionMessage): void {
48
+ if (this.clientId !== message.clientId) {
49
+ return;
50
+ }
51
+ this.checkMessageOrigin(message);
52
+ const action = message.action;
53
+ this.logger.log(this, 'receiving', action);
54
+ this.actionDispatcher.dispatch(action);
55
+ }
56
+
57
+ protected checkMessageOrigin(message: ActionMessage): void {
58
+ const isLocalDispatch = (message as any)['__localDispatch'] ?? false;
59
+ if (!isLocalDispatch) {
60
+ ServerAction.mark(message.action);
61
+ }
62
+ }
63
+ }