@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
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.VsCodeGLSPModelSource = exports.ExtensionAction = void 0;
10
+ /********************************************************************************
11
+ * Copyright (c) 2023 EclipseSource and others.
12
+ *
13
+ * This program and the accompanying materials are made available under the
14
+ * terms of the Eclipse Public License v. 2.0 which is available at
15
+ * http://www.eclipse.org/legal/epl-2.0.
16
+ *
17
+ * This Source Code may also be made available under the following Secondary
18
+ * Licenses when the conditions for such availability set forth in the Eclipse
19
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
20
+ * with the GNU Classpath Exception which is available at
21
+ * https://www.gnu.org/software/classpath/license.html.
22
+ *
23
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
24
+ ********************************************************************************/
25
+ const client_1 = require("@eclipse-glsp/client");
26
+ const inversify_1 = require("inversify");
27
+ var ExtensionAction;
28
+ (function (ExtensionAction) {
29
+ function is(object) {
30
+ return client_1.Action.is(object) && '__localDispatch' in object && object.__localDispatch === true;
31
+ }
32
+ ExtensionAction.is = is;
33
+ /**
34
+ * Mark the given action as {@link ServerAction} by attaching the "_receivedFromServer" property
35
+ * @param action The action that should be marked as server action
36
+ */
37
+ function mark(action) {
38
+ action.__localDispatch = true;
39
+ }
40
+ ExtensionAction.mark = mark;
41
+ })(ExtensionAction || (exports.ExtensionAction = ExtensionAction = {}));
42
+ /**
43
+ * Customization of the default {@link GLSPModelSource} for the vscode integration.
44
+ * Also takes locally dispatched actions (i.e. actions that are originating from or intended for the host extension) into consideration.
45
+ */
46
+ let VsCodeGLSPModelSource = class VsCodeGLSPModelSource extends client_1.GLSPModelSource {
47
+ messageReceived(message) {
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
+ checkMessageOrigin(message) {
57
+ var _a;
58
+ const isLocalDispatch = (_a = message['__localDispatch']) !== null && _a !== void 0 ? _a : false;
59
+ if (!isLocalDispatch) {
60
+ client_1.ServerAction.mark(message.action);
61
+ }
62
+ }
63
+ };
64
+ exports.VsCodeGLSPModelSource = VsCodeGLSPModelSource;
65
+ exports.VsCodeGLSPModelSource = VsCodeGLSPModelSource = __decorate([
66
+ (0, inversify_1.injectable)()
67
+ ], VsCodeGLSPModelSource);
68
+ //# sourceMappingURL=vscode-glsp-modelsource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vscode-glsp-modelsource.js","sourceRoot":"","sources":["../../../src/features/default/vscode-glsp-modelsource.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAA4F;AAC5F,yCAAuC;AAUvC,IAAiB,eAAe,CAY/B;AAZD,WAAiB,eAAe;IAC5B,SAAgB,EAAE,CAAC,MAAe;QAC9B,OAAO,eAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,iBAAiB,IAAI,MAAM,IAAI,MAAM,CAAC,eAAe,KAAK,IAAI,CAAC;IAC/F,CAAC;IAFe,kBAAE,KAEjB,CAAA;IAED;;;OAGG;IACH,SAAgB,IAAI,CAAC,MAAc;QAC9B,MAA0B,CAAC,eAAe,GAAG,IAAI,CAAC;IACvD,CAAC;IAFe,oBAAI,OAEnB,CAAA;AACL,CAAC,EAZgB,eAAe,+BAAf,eAAe,QAY/B;AAED;;;GAGG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,wBAAe;IACnC,eAAe,CAAC,OAAsB;QACrD,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,EAAE;YACpC,OAAO;SACV;QACD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAES,kBAAkB,CAAC,OAAsB;;QAC/C,MAAM,eAAe,GAAG,MAAC,OAAe,CAAC,iBAAiB,CAAC,mCAAI,KAAK,CAAC;QACrE,IAAI,CAAC,eAAe,EAAE;YAClB,qBAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACrC;IACL,CAAC;CACJ,CAAA;AAjBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CAiBjC"}
@@ -0,0 +1,18 @@
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 { FeatureModule } from '@eclipse-glsp/client';
17
+ export declare const vscodeExportModule: FeatureModule;
18
+ //# sourceMappingURL=export-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-module.d.ts","sourceRoot":"","sources":["../../../src/features/export/export-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAmB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGtE,eAAO,MAAM,kBAAkB,eAE7B,CAAC"}
@@ -0,0 +1,24 @@
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.vscodeExportModule = void 0;
19
+ const client_1 = require("@eclipse-glsp/client");
20
+ const extension_action_handler_1 = require("../default/extension-action-handler");
21
+ exports.vscodeExportModule = new client_1.FeatureModule(bind => {
22
+ bind(extension_action_handler_1.ExtensionActionKind).toConstantValue(client_1.ExportSvgAction.KIND);
23
+ });
24
+ //# sourceMappingURL=export-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-module.js","sourceRoot":"","sources":["../../../src/features/export/export-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,iDAAsE;AACtE,kFAA0E;AAE7D,QAAA,kBAAkB,GAAG,IAAI,sBAAa,CAAC,IAAI,CAAC,EAAE;IACvD,IAAI,CAAC,8CAAmB,CAAC,CAAC,eAAe,CAAC,wBAAe,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
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 { FeatureModule } from '@eclipse-glsp/client';
17
+ export declare const vscodeNavigationModule: FeatureModule;
18
+ //# sourceMappingURL=navigation-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-module.d.ts","sourceRoot":"","sources":["../../../src/features/navigation/navigation-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAoD,MAAM,sBAAsB,CAAC;AAGvG,eAAO,MAAM,sBAAsB,eAEf,CAAC"}
@@ -0,0 +1,24 @@
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.vscodeNavigationModule = void 0;
19
+ const client_1 = require("@eclipse-glsp/client");
20
+ const extension_action_handler_1 = require("../default/extension-action-handler");
21
+ exports.vscodeNavigationModule = new client_1.FeatureModule(bind => {
22
+ bind(extension_action_handler_1.ExtensionActionKind).toConstantValue(client_1.NavigateToExternalTargetAction.KIND);
23
+ }, client_1.navigationModule);
24
+ //# sourceMappingURL=navigation-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-module.js","sourceRoot":"","sources":["../../../src/features/navigation/navigation-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,iDAAuG;AACvG,kFAA0E;AAE7D,QAAA,sBAAsB,GAAG,IAAI,sBAAa,CAAC,IAAI,CAAC,EAAE;IAC3D,IAAI,CAAC,8CAAmB,CAAC,CAAC,eAAe,CAAC,uCAA8B,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC,EAAE,yBAAgB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
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 { FeatureModule } from '@eclipse-glsp/client';
17
+ export declare const vscodeNotificationModule: FeatureModule;
18
+ //# sourceMappingURL=notification-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-module.d.ts","sourceRoot":"","sources":["../../../src/features/notification/notification-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAqB,aAAa,EAA4D,MAAM,sBAAsB,CAAC;AAGlI,eAAO,MAAM,wBAAwB,eAKnC,CAAC"}
@@ -0,0 +1,27 @@
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.vscodeNotificationModule = void 0;
19
+ const client_1 = require("@eclipse-glsp/client");
20
+ const extension_action_handler_1 = require("../default/extension-action-handler");
21
+ exports.vscodeNotificationModule = new client_1.FeatureModule(bind => {
22
+ bind(extension_action_handler_1.ExtensionActionKind).toConstantValue(client_1.MessageAction.KIND);
23
+ bind(extension_action_handler_1.ExtensionActionKind).toConstantValue(client_1.StartProgressAction.KIND);
24
+ bind(extension_action_handler_1.ExtensionActionKind).toConstantValue(client_1.EndProgressAction.KIND);
25
+ bind(extension_action_handler_1.ExtensionActionKind).toConstantValue(client_1.UpdateProgressAction.KIND);
26
+ });
27
+ //# sourceMappingURL=notification-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-module.js","sourceRoot":"","sources":["../../../src/features/notification/notification-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,iDAAkI;AAClI,kFAA0E;AAE7D,QAAA,wBAAwB,GAAG,IAAI,sBAAa,CAAC,IAAI,CAAC,EAAE;IAC7D,IAAI,CAAC,8CAAmB,CAAC,CAAC,eAAe,CAAC,sBAAa,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,CAAC,8CAAmB,CAAC,CAAC,eAAe,CAAC,4BAAmB,CAAC,IAAI,CAAC,CAAC;IACpE,IAAI,CAAC,8CAAmB,CAAC,CAAC,eAAe,CAAC,0BAAiB,CAAC,IAAI,CAAC,CAAC;IAClE,IAAI,CAAC,8CAAmB,CAAC,CAAC,eAAe,CAAC,6BAAoB,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2018 TypeFox and others.
3
+ * Modifications: (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
+ ********************************************************************************/
17
+ import { DiagramLoader, DiagramLoadingOptions, IActionDispatcher, IDiagramOptions, ModelSource, ViewerOptions } from '@eclipse-glsp/client';
18
+ export declare const GLSPDiagramWidgetFactory: unique symbol;
19
+ export type GLSPDiagramWidgetFactory = () => GLSPDiagramWidget;
20
+ export declare abstract class GLSPDiagramWidget {
21
+ protected actionDispatcher: IActionDispatcher;
22
+ protected modelSource: ModelSource;
23
+ protected diagramOptions: IDiagramOptions;
24
+ protected viewerOptions: ViewerOptions;
25
+ protected diagramLoader: DiagramLoader;
26
+ get clientId(): string;
27
+ initialize(): void;
28
+ protected initializeHtml(): void;
29
+ protected createDiagramLoadingOptions(): DiagramLoadingOptions | undefined;
30
+ loadDiagram(): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=glsp-diagram-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glsp-diagram-widget.d.ts","sourceRoot":"","sources":["../src/glsp-diagram-widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;kFAekF;AAElF,OAAO,EACH,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,WAAW,EAEX,aAAa,EAChB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAC3E,MAAM,MAAM,wBAAwB,GAAG,MAAM,iBAAiB,CAAC;AAE/D,8BACsB,iBAAiB;IAEnC,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAG9C,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IAGnC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;IAG1C,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAGvC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAEvC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAGD,UAAU,IAAI,IAAI;IAKlB,SAAS,CAAC,cAAc,IAAI,IAAI;IAahC,SAAS,CAAC,2BAA2B,IAAI,qBAAqB,GAAG,SAAS;IAI1E,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GLSPDiagramWidget = exports.GLSPDiagramWidgetFactory = void 0;
13
+ /********************************************************************************
14
+ * Copyright (c) 2018 TypeFox and others.
15
+ * Modifications: (c) 2020-2023 EclipseSource and others.
16
+ *
17
+ * This program and the accompanying materials are made available under the
18
+ * terms of the Eclipse Public License v. 2.0 which is available at
19
+ * http://www.eclipse.org/legal/epl-2.0.
20
+ *
21
+ * This Source Code may also be made available under the following Secondary
22
+ * Licenses when the conditions for such availability set forth in the Eclipse
23
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
24
+ * with the GNU Classpath Exception which is available at
25
+ * https://www.gnu.org/software/classpath/license.html.
26
+ *
27
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
28
+ ********************************************************************************/
29
+ // based on https://github.com/eclipse-sprotty/sprotty-vscode/blob/v0.3.0/sprotty-vscode-webview/src/vscode-diagram-widget.ts
30
+ const client_1 = require("@eclipse-glsp/client");
31
+ const inversify_1 = require("inversify");
32
+ exports.GLSPDiagramWidgetFactory = Symbol('GLSPDiagramWidgetFactory');
33
+ let GLSPDiagramWidget = class GLSPDiagramWidget {
34
+ get clientId() {
35
+ return this.diagramOptions.clientId;
36
+ }
37
+ initialize() {
38
+ this.initializeHtml();
39
+ this.loadDiagram();
40
+ }
41
+ initializeHtml() {
42
+ const containerDiv = document.getElementById(this.clientId + '_container');
43
+ if (containerDiv) {
44
+ const svgContainer = document.createElement('div');
45
+ svgContainer.id = this.viewerOptions.baseDiv;
46
+ containerDiv.appendChild(svgContainer);
47
+ const hiddenContainer = document.createElement('div');
48
+ hiddenContainer.id = this.viewerOptions.hiddenDiv;
49
+ document.body.appendChild(hiddenContainer);
50
+ }
51
+ }
52
+ createDiagramLoadingOptions() {
53
+ return undefined;
54
+ }
55
+ loadDiagram() {
56
+ return this.diagramLoader.load(this.createDiagramLoadingOptions());
57
+ }
58
+ };
59
+ exports.GLSPDiagramWidget = GLSPDiagramWidget;
60
+ __decorate([
61
+ (0, inversify_1.inject)(client_1.TYPES.IActionDispatcher),
62
+ __metadata("design:type", Object)
63
+ ], GLSPDiagramWidget.prototype, "actionDispatcher", void 0);
64
+ __decorate([
65
+ (0, inversify_1.inject)(client_1.TYPES.ModelSource),
66
+ __metadata("design:type", client_1.ModelSource)
67
+ ], GLSPDiagramWidget.prototype, "modelSource", void 0);
68
+ __decorate([
69
+ (0, inversify_1.inject)(client_1.TYPES.IDiagramOptions),
70
+ __metadata("design:type", Object)
71
+ ], GLSPDiagramWidget.prototype, "diagramOptions", void 0);
72
+ __decorate([
73
+ (0, inversify_1.inject)(client_1.TYPES.ViewerOptions),
74
+ __metadata("design:type", Object)
75
+ ], GLSPDiagramWidget.prototype, "viewerOptions", void 0);
76
+ __decorate([
77
+ (0, inversify_1.inject)(client_1.DiagramLoader),
78
+ __metadata("design:type", client_1.DiagramLoader)
79
+ ], GLSPDiagramWidget.prototype, "diagramLoader", void 0);
80
+ __decorate([
81
+ (0, inversify_1.postConstruct)(),
82
+ __metadata("design:type", Function),
83
+ __metadata("design:paramtypes", []),
84
+ __metadata("design:returntype", void 0)
85
+ ], GLSPDiagramWidget.prototype, "initialize", null);
86
+ exports.GLSPDiagramWidget = GLSPDiagramWidget = __decorate([
87
+ (0, inversify_1.injectable)()
88
+ ], GLSPDiagramWidget);
89
+ //# sourceMappingURL=glsp-diagram-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glsp-diagram-widget.js","sourceRoot":"","sources":["../src/glsp-diagram-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;kFAekF;AAClF,6HAA6H;AAC7H,iDAQ8B;AAC9B,yCAA8D;AAEjD,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAIpE,IAAe,iBAAiB,GAAhC,MAAe,iBAAiB;IAgBnC,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;IACxC,CAAC;IAGD,UAAU;QACN,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAES,cAAc;QACpB,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,CAAC;QAC3E,IAAI,YAAY,EAAE;YACd,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACnD,YAAY,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;YAC7C,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAEvC,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACtD,eAAe,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;SAC9C;IACL,CAAC;IAES,2BAA2B;QACjC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AA9CqB,8CAAiB;AAEzB;IADT,IAAA,kBAAM,EAAC,cAAK,CAAC,iBAAiB,CAAC;;2DACc;AAGpC;IADT,IAAA,kBAAM,EAAC,cAAK,CAAC,WAAW,CAAC;8BACH,oBAAW;sDAAC;AAGzB;IADT,IAAA,kBAAM,EAAC,cAAK,CAAC,eAAe,CAAC;;yDACY;AAGhC;IADT,IAAA,kBAAM,EAAC,cAAK,CAAC,aAAa,CAAC;;wDACW;AAG7B;IADT,IAAA,kBAAM,EAAC,sBAAa,CAAC;8BACG,sBAAa;wDAAC;AAOvC;IADC,IAAA,yBAAa,GAAE;;;;mDAIf;4BAxBiB,iBAAiB;IADtC,IAAA,sBAAU,GAAE;GACS,iBAAiB,CA8CtC"}
@@ -1,13 +1,47 @@
1
- import { Container } from 'inversify';
2
- import { SprottyDiagramIdentifier, SprottyStarter } from 'sprotty-vscode-webview';
3
- import { GLSPDiagramIdentifier } from './diagram-identifer';
4
- export declare abstract class GLSPStarter extends SprottyStarter {
5
- protected acceptDiagramIdentifier(): void;
6
- protected addVscodeBindings(container: Container, diagramIdentifier: GLSPDiagramIdentifier): void;
7
- protected configureExtensionActionHandler(container: Container, diagramIdentifier: SprottyDiagramIdentifier): void;
1
+ /********************************************************************************
2
+ * Copyright (c) 2018 TypeFox and others.
3
+ * Modifications: (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
+ ********************************************************************************/
17
+ import { ContainerConfiguration } from '@eclipse-glsp/client';
18
+ import { Container, ContainerModule } from 'inversify';
19
+ import { NotificationType } from 'vscode-messenger-common';
20
+ import { Messenger } from 'vscode-messenger-webview';
21
+ import { GLSPDiagramIdentifier } from './diagram-identifier';
22
+ export declare const WebviewReadyNotification: NotificationType<void>;
23
+ export declare const InitializeNotification: NotificationType<GLSPDiagramIdentifier>;
24
+ export declare abstract class GLSPStarter {
25
+ protected container?: Container;
26
+ protected messenger: Messenger;
27
+ constructor();
28
+ protected sendReadyMessage(): void;
29
+ protected acceptDiagramIdentifier(identifier: GLSPDiagramIdentifier): void;
30
+ protected createDiagramOptionsModule(identifier: GLSPDiagramIdentifier): ContainerModule;
8
31
  /**
9
- * All kinds of actions that should (also) be delegated to and handled by the vscode extension
32
+ * Retrieves additional {@link ContainerConfiguration} for the diagram container.
33
+ * Typically this composes a set of vscode specific customization modules.
34
+ * @returns the container configuration
10
35
  */
11
- protected get extensionActionKinds(): string[];
36
+ protected getContainerConfiguration(): ContainerConfiguration;
37
+ protected abstract createContainer(...containerConfiguration: ContainerConfiguration): Container;
38
+ /**
39
+ * Optional hook that can be implemented to customize diagram container bindings before it's used
40
+ * to instantiate the diagram services
41
+ * @param container The diagram container
42
+ * @param diagramIdentifier The diagram identfier
43
+ */
44
+ protected addVscodeBindings?(container: Container, diagramIdentifier: GLSPDiagramIdentifier): void;
12
45
  }
46
+ export declare function decodeURI(uri: string): string;
13
47
  //# sourceMappingURL=glsp-starter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glsp-starter.d.ts","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACH,wBAAwB,EACxB,cAAc,EAIjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,qBAAqB,EAAuB,MAAM,qBAAqB,CAAC;AAKjF,8BAAsB,WAAY,SAAQ,cAAc;cACjC,uBAAuB,IAAI,IAAI;cA2B/B,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,qBAAqB,GAAG,IAAI;IAuB1G,SAAS,CAAC,+BAA+B,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,wBAAwB,GAAG,IAAI;IAMlH;;OAEG;IACH,SAAS,KAAK,oBAAoB,IAAI,MAAM,EAAE,CAQ7C;CACJ"}
1
+ {"version":3,"file":"glsp-starter.d.ts","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;kFAekF;AAElF,OAAO,EAAE,sBAAsB,EAA8B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAkB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAa,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,eAAO,MAAM,wBAAwB,EAAE,gBAAgB,CAAC,IAAI,CAAuB,CAAC;AACpF,eAAO,MAAM,sBAAsB,EAAE,gBAAgB,CAAC,qBAAqB,CAA4B,CAAC;AAIxG,8BAAsB,WAAW;IAC7B,SAAS,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAChC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;;IAW/B,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAIlC,SAAS,CAAC,uBAAuB,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI;IAe1E,SAAS,CAAC,0BAA0B,CAAC,UAAU,EAAE,qBAAqB,GAAG,eAAe;IAUxF;;;;OAIG;IACH,SAAS,CAAC,yBAAyB,IAAI,sBAAsB;IAI7D,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,sBAAsB,EAAE,sBAAsB,GAAG,SAAS;IAEhG;;;;;OAKG;IACH,SAAS,CAAC,iBAAiB,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,qBAAqB,GAAG,IAAI;CACrG;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GLSPStarter = void 0;
3
+ exports.decodeURI = exports.GLSPStarter = exports.InitializeNotification = exports.WebviewReadyNotification = void 0;
4
4
  /********************************************************************************
5
- * Copyright (c) 2020-2022 EclipseSource and others.
5
+ * Copyright (c) 2018 TypeFox and others.
6
+ * Modifications: (c) 2020-2023 EclipseSource and others.
6
7
  *
7
8
  * This program and the accompanying materials are made available under the
8
9
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -16,77 +17,63 @@ exports.GLSPStarter = void 0;
16
17
  *
17
18
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
19
  ********************************************************************************/
20
+ // based on https://github.com/eclipse-sprotty/sprotty-vscode/blob/v0.3.0/sprotty-vscode-webview/src/sprotty-starter.ts
19
21
  const client_1 = require("@eclipse-glsp/client");
20
- const sprotty_vscode_webview_1 = require("sprotty-vscode-webview");
21
- const services_1 = require("sprotty-vscode-webview/lib/services");
22
- const copy_paste_handler_provider_1 = require("./copy-paste-handler-provider");
23
- const diagram_identifer_1 = require("./diagram-identifer");
24
- const extension_action_handler_1 = require("./extension-action-handler");
25
- const glsp_vscode_diagram_widget_1 = require("./glsp-vscode-diagram-widget");
26
- const glsp_vscode_diagramserver_1 = require("./glsp-vscode-diagramserver");
27
- class GLSPStarter extends sprotty_vscode_webview_1.SprottyStarter {
28
- acceptDiagramIdentifier() {
29
- console.log('Waiting for diagram identifier...');
30
- const eventListener = (message) => {
31
- if ((0, diagram_identifer_1.isDiagramIdentifier)(message.data)) {
32
- console.log(message);
33
- if (this.container) {
34
- const oldIdentifier = this.container.get(diagram_identifer_1.GLSPDiagramIdentifier);
35
- const newIdentifier = message.data;
36
- oldIdentifier.diagramType = newIdentifier.diagramType;
37
- oldIdentifier.uri = newIdentifier.uri;
38
- const diagramWidget = this.container.get(sprotty_vscode_webview_1.VscodeDiagramWidget);
39
- diagramWidget.requestModel();
40
- }
41
- else {
42
- console.log('...received...', message);
43
- const diagramIdentifier = message.data;
44
- this.container = this.createContainer(diagramIdentifier);
45
- this.addVscodeBindings(this.container, diagramIdentifier);
46
- if (diagramIdentifier.initializeResult) {
47
- (0, client_1.configureServerActions)(diagramIdentifier.initializeResult, diagramIdentifier.diagramType, this.container);
48
- }
49
- this.container.get(sprotty_vscode_webview_1.VscodeDiagramWidget);
50
- }
51
- }
52
- };
53
- window.addEventListener('message', eventListener);
22
+ const vscode_messenger_common_1 = require("vscode-messenger-common");
23
+ const vscode_messenger_webview_1 = require("vscode-messenger-webview");
24
+ const default_modules_1 = require("./default-modules");
25
+ const diagram_identifier_1 = require("./diagram-identifier");
26
+ const glsp_diagram_widget_1 = require("./glsp-diagram-widget");
27
+ const webview_glsp_client_1 = require("./webview-glsp-client");
28
+ exports.WebviewReadyNotification = { method: 'ready' };
29
+ exports.InitializeNotification = { method: 'initialize' };
30
+ class GLSPStarter {
31
+ constructor() {
32
+ this.messenger = new vscode_messenger_webview_1.Messenger(acquireVsCodeApi());
33
+ this.messenger.onNotification(exports.InitializeNotification, identifier => this.acceptDiagramIdentifier(identifier));
34
+ this.messenger.start();
35
+ this.sendReadyMessage();
54
36
  }
55
- addVscodeBindings(container, diagramIdentifier) {
56
- container.bind(services_1.VsCodeApi).toConstantValue(this.vscodeApi);
57
- container.bind(glsp_vscode_diagram_widget_1.GLSPVscodeDiagramWidget).toSelf().inSingletonScope();
58
- container.bind(sprotty_vscode_webview_1.VscodeDiagramWidget).toService(glsp_vscode_diagram_widget_1.GLSPVscodeDiagramWidget);
59
- container
60
- .bind(sprotty_vscode_webview_1.VscodeDiagramWidgetFactory)
61
- .toFactory(context => () => context.container.get(glsp_vscode_diagram_widget_1.GLSPVscodeDiagramWidget));
62
- container.bind(diagram_identifer_1.GLSPDiagramIdentifier).toConstantValue(diagramIdentifier);
63
- container
64
- .bind(copy_paste_handler_provider_1.CopyPasteHandlerProvider)
65
- .toProvider(ctx => () => new Promise(resolve => resolve(ctx.container.get(client_1.TYPES.ICopyPasteHandler))));
66
- container.bind(sprotty_vscode_webview_1.SprottyDiagramIdentifier).toService(diagram_identifer_1.GLSPDiagramIdentifier);
67
- container.bind(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer).toSelf().inSingletonScope();
68
- container.bind(sprotty_vscode_webview_1.VscodeDiagramServer).toService(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer);
69
- container.bind(client_1.TYPES.ModelSource).toService(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer);
70
- container.bind(client_1.DiagramServerProxy).toService(glsp_vscode_diagramserver_1.GLSPVscodeDiagramServer);
71
- this.configureExtensionActionHandler(container, diagramIdentifier);
37
+ sendReadyMessage() {
38
+ this.messenger.sendNotification(exports.WebviewReadyNotification, vscode_messenger_common_1.HOST_EXTENSION);
72
39
  }
73
- configureExtensionActionHandler(container, diagramIdentifier) {
74
- const extensionActionHandler = new extension_action_handler_1.GLSPVscodeExtensionActionHandler(this.extensionActionKinds, diagramIdentifier, this.vscodeApi);
75
- container.bind(extension_action_handler_1.GLSPVscodeExtensionActionHandler).toConstantValue(extensionActionHandler);
76
- container.bind(client_1.TYPES.IActionHandlerInitializer).toService(extension_action_handler_1.GLSPVscodeExtensionActionHandler);
40
+ acceptDiagramIdentifier(identifier) {
41
+ var _a;
42
+ if (this.container) {
43
+ const oldIdentifier = this.container.get(diagram_identifier_1.GLSPDiagramIdentifier);
44
+ oldIdentifier.diagramType = identifier.diagramType;
45
+ oldIdentifier.uri = identifier.uri;
46
+ const diagramWidget = this.container.get(glsp_diagram_widget_1.GLSPDiagramWidget);
47
+ diagramWidget.loadDiagram();
48
+ }
49
+ else {
50
+ const diagramModule = this.createDiagramOptionsModule(identifier);
51
+ this.container = this.createContainer(diagramModule, ...this.getContainerConfiguration());
52
+ (_a = this.addVscodeBindings) === null || _a === void 0 ? void 0 : _a.call(this, this.container, identifier);
53
+ this.container.get(glsp_diagram_widget_1.GLSPDiagramWidget);
54
+ }
55
+ }
56
+ createDiagramOptionsModule(identifier) {
57
+ const glspClient = new webview_glsp_client_1.WebviewGlspClient({ id: identifier.diagramType, messenger: this.messenger });
58
+ return (0, client_1.createDiagramOptionsModule)({
59
+ clientId: identifier.clientId,
60
+ diagramType: identifier.diagramType,
61
+ glspClientProvider: async () => glspClient,
62
+ sourceUri: decodeURIComponent(identifier.uri)
63
+ });
77
64
  }
78
65
  /**
79
- * All kinds of actions that should (also) be delegated to and handled by the vscode extension
66
+ * Retrieves additional {@link ContainerConfiguration} for the diagram container.
67
+ * Typically this composes a set of vscode specific customization modules.
68
+ * @returns the container configuration
80
69
  */
81
- get extensionActionKinds() {
82
- return [
83
- client_1.NavigateToExternalTargetAction.KIND,
84
- client_1.RequestClipboardDataAction.KIND,
85
- client_1.SetClipboardDataAction.KIND,
86
- client_1.SelectAction.KIND,
87
- client_1.ExportSvgAction.KIND
88
- ];
70
+ getContainerConfiguration() {
71
+ return [default_modules_1.VSCODE_DEFAULT_MODULE_CONFIG];
89
72
  }
90
73
  }
91
74
  exports.GLSPStarter = GLSPStarter;
75
+ function decodeURI(uri) {
76
+ return decodeURIComponent(uri.replace(/\+/g, ' '));
77
+ }
78
+ exports.decodeURI = decodeURI;
92
79
  //# sourceMappingURL=glsp-starter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glsp-starter.js","sourceRoot":"","sources":["../src/glsp-starter.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAU8B;AAE9B,mEAMgC;AAChC,kEAAgE;AAChE,+EAAyE;AACzE,2DAAiF;AACjF,yEAA8E;AAC9E,6EAAuE;AACvE,2EAAsE;AAEtE,MAAsB,WAAY,SAAQ,uCAAc;IACjC,uBAAuB;QACtC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,CAAC,OAAY,EAAQ,EAAE;YACzC,IAAI,IAAA,uCAAmB,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACnC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrB,IAAI,IAAI,CAAC,SAAS,EAAE;oBAChB,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAwB,yCAAqB,CAAC,CAAC;oBACvF,MAAM,aAAa,GAAG,OAAO,CAAC,IAA6B,CAAC;oBAC5D,aAAa,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;oBACtD,aAAa,CAAC,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;oBACtC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,4CAAmB,CAAC,CAAC;oBAC9D,aAAa,CAAC,YAAY,EAAE,CAAC;iBAChC;qBAAM;oBACH,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;oBACvC,MAAM,iBAAiB,GAAG,OAAO,CAAC,IAA6B,CAAC;oBAChE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;oBACzD,IAAI,CAAC,iBAAiB,C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CAAC,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,uCAAiB,CAAC,CAAC;SACzC;IACL,CAAC;IAES,0BAA0B,CAAC,UAAiC;QAClE,MAAM,UAAU,GAAG,IAAI,uCAAiB,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACpG,OAAO,IAAA,mCAA0B,EAAC;YAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,kBAAkB,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU;YAC1C,SAAS,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC;SAChD,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACO,yBAAyB;QAC/B,OAAO,CAAC,8CAA4B,CAAC,CAAC;IAC1C,CAAC;CAWJ;AA5DD,kCA4DC;AAED,SAAgB,SAAS,CAAC,GAAW;IACjC,OAAO,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AACvD,CAAC;AAFD,8BAEC"}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020 EclipseSource and others.
2
+ * Copyright (c) 2020-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,6 +13,16 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ export * from './default-modules';
17
+ export * from './diagram-identifier';
18
+ export * from './features/copyPaste/copy-paste-module';
19
+ export * from './features/copyPaste/copy-paste-startup';
20
+ export * from './features/default/default-module';
21
+ export * from './features/default/vscode-glsp-modelsource';
22
+ export * from './features/export/export-module';
23
+ export * from './features/navigation/navigation-module';
24
+ export * from './features/notification/notification-module';
25
+ export * from './glsp-diagram-widget';
16
26
  export * from './glsp-starter';
17
- export * from './glsp-vscode-diagramserver';
27
+ export * from './webview-glsp-client';
18
28
  //# sourceMappingURL=index.d.ts.map