aurora-langium 0.0.8 → 0.0.11
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/out/extension/main.cjs +2873 -37
- package/out/extension/main.cjs.map +4 -4
- package/out/extension/main.d.ts +1 -1
- package/out/extension/main.js +61 -3
- package/out/extension/main.js.map +1 -1
- package/out/language/aurora-diagram-generator.d.ts +5 -5
- package/out/language/aurora-diagram-generator.js +18 -8
- package/out/language/aurora-diagram-generator.js.map +1 -1
- package/out/language/aurora-module.js +2 -2
- package/out/language/aurora-module.js.map +1 -1
- package/out/language/aurora-scope.js +12 -19
- package/out/language/aurora-scope.js.map +1 -1
- package/out/language/main.cjs +264 -51
- package/out/language/main.cjs.map +4 -4
- package/out/language/main.js +25 -5
- package/out/language/main.js.map +1 -1
- package/package.json +30 -3
- package/src/extension/main.ts +74 -4
- package/src/language/aurora-diagram-generator.ts +36 -21
- package/src/language/aurora-module.ts +2 -1
- package/src/language/aurora-scope.ts +31 -32
- package/src/language/main.ts +25 -5
package/out/extension/main.cjs
CHANGED
|
@@ -6719,8 +6719,8 @@ var require_protocolCodeAction = __commonJS({
|
|
|
6719
6719
|
"node_modules/vscode-languageclient/lib/common/protocolCodeAction.js"(exports2) {
|
|
6720
6720
|
"use strict";
|
|
6721
6721
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6722
|
-
var
|
|
6723
|
-
var ProtocolCodeAction = class extends
|
|
6722
|
+
var vscode2 = require("vscode");
|
|
6723
|
+
var ProtocolCodeAction = class extends vscode2.CodeAction {
|
|
6724
6724
|
constructor(title, data) {
|
|
6725
6725
|
super(title);
|
|
6726
6726
|
this.data = data;
|
|
@@ -6736,7 +6736,7 @@ var require_protocolDiagnostic = __commonJS({
|
|
|
6736
6736
|
"use strict";
|
|
6737
6737
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6738
6738
|
exports2.ProtocolDiagnostic = exports2.DiagnosticCode = void 0;
|
|
6739
|
-
var
|
|
6739
|
+
var vscode2 = require("vscode");
|
|
6740
6740
|
var Is = require_is();
|
|
6741
6741
|
var DiagnosticCode;
|
|
6742
6742
|
(function(DiagnosticCode2) {
|
|
@@ -6746,7 +6746,7 @@ var require_protocolDiagnostic = __commonJS({
|
|
|
6746
6746
|
}
|
|
6747
6747
|
DiagnosticCode2.is = is;
|
|
6748
6748
|
})(DiagnosticCode || (exports2.DiagnosticCode = DiagnosticCode = {}));
|
|
6749
|
-
var ProtocolDiagnostic = class extends
|
|
6749
|
+
var ProtocolDiagnostic = class extends vscode2.Diagnostic {
|
|
6750
6750
|
constructor(range, message, severity, data) {
|
|
6751
6751
|
super(range, message, severity);
|
|
6752
6752
|
this.data = data;
|
|
@@ -10783,7 +10783,7 @@ var require_notebook = __commonJS({
|
|
|
10783
10783
|
"use strict";
|
|
10784
10784
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10785
10785
|
exports2.NotebookDocumentSyncFeature = void 0;
|
|
10786
|
-
var
|
|
10786
|
+
var vscode2 = require("vscode");
|
|
10787
10787
|
var minimatch = require_minimatch();
|
|
10788
10788
|
var proto = require_main3();
|
|
10789
10789
|
var UUID = require_uuid();
|
|
@@ -10838,9 +10838,9 @@ var require_notebook = __commonJS({
|
|
|
10838
10838
|
c2p2.asNotebookCell = asNotebookCell;
|
|
10839
10839
|
function asNotebookCellKind(kind) {
|
|
10840
10840
|
switch (kind) {
|
|
10841
|
-
case
|
|
10841
|
+
case vscode2.NotebookCellKind.Markup:
|
|
10842
10842
|
return proto.NotebookCellKind.Markup;
|
|
10843
|
-
case
|
|
10843
|
+
case vscode2.NotebookCellKind.Code:
|
|
10844
10844
|
return proto.NotebookCellKind.Code;
|
|
10845
10845
|
}
|
|
10846
10846
|
}
|
|
@@ -11092,25 +11092,25 @@ var require_notebook = __commonJS({
|
|
|
11092
11092
|
this.notebookDidOpen = /* @__PURE__ */ new Set();
|
|
11093
11093
|
this.disposables = [];
|
|
11094
11094
|
this.selector = client2.protocol2CodeConverter.asDocumentSelector($NotebookDocumentSyncOptions.asDocumentSelector(options));
|
|
11095
|
-
|
|
11095
|
+
vscode2.workspace.onDidOpenNotebookDocument((notebookDocument) => {
|
|
11096
11096
|
this.notebookDidOpen.add(notebookDocument.uri.toString());
|
|
11097
11097
|
this.didOpen(notebookDocument);
|
|
11098
11098
|
}, void 0, this.disposables);
|
|
11099
|
-
for (const notebookDocument of
|
|
11099
|
+
for (const notebookDocument of vscode2.workspace.notebookDocuments) {
|
|
11100
11100
|
this.notebookDidOpen.add(notebookDocument.uri.toString());
|
|
11101
11101
|
this.didOpen(notebookDocument);
|
|
11102
11102
|
}
|
|
11103
|
-
|
|
11103
|
+
vscode2.workspace.onDidChangeNotebookDocument((event) => this.didChangeNotebookDocument(event), void 0, this.disposables);
|
|
11104
11104
|
if (this.options.save === true) {
|
|
11105
|
-
|
|
11105
|
+
vscode2.workspace.onDidSaveNotebookDocument((notebookDocument) => this.didSave(notebookDocument), void 0, this.disposables);
|
|
11106
11106
|
}
|
|
11107
|
-
|
|
11107
|
+
vscode2.workspace.onDidCloseNotebookDocument((notebookDocument) => {
|
|
11108
11108
|
this.didClose(notebookDocument);
|
|
11109
11109
|
this.notebookDidOpen.delete(notebookDocument.uri.toString());
|
|
11110
11110
|
}, void 0, this.disposables);
|
|
11111
11111
|
}
|
|
11112
11112
|
getState() {
|
|
11113
|
-
for (const notebook of
|
|
11113
|
+
for (const notebook of vscode2.workspace.notebookDocuments) {
|
|
11114
11114
|
const matchingCells = this.getMatchingCells(notebook);
|
|
11115
11115
|
if (matchingCells !== void 0) {
|
|
11116
11116
|
return { kind: "document", id: "$internal", registrations: true, matches: true };
|
|
@@ -11122,10 +11122,10 @@ var require_notebook = __commonJS({
|
|
|
11122
11122
|
return "notebook";
|
|
11123
11123
|
}
|
|
11124
11124
|
handles(textDocument) {
|
|
11125
|
-
return
|
|
11125
|
+
return vscode2.languages.match(this.selector, textDocument) > 0;
|
|
11126
11126
|
}
|
|
11127
11127
|
didOpenNotebookCellTextDocument(notebookDocument, cell) {
|
|
11128
|
-
if (
|
|
11128
|
+
if (vscode2.languages.match(this.selector, cell.document) === 0) {
|
|
11129
11129
|
return;
|
|
11130
11130
|
}
|
|
11131
11131
|
if (!this.notebookDidOpen.has(notebookDocument.uri.toString())) {
|
|
@@ -11156,7 +11156,7 @@ var require_notebook = __commonJS({
|
|
|
11156
11156
|
}
|
|
11157
11157
|
}
|
|
11158
11158
|
didChangeNotebookCellTextDocument(notebookDocument, event) {
|
|
11159
|
-
if (
|
|
11159
|
+
if (vscode2.languages.match(this.selector, event.document) === 0) {
|
|
11160
11160
|
return;
|
|
11161
11161
|
}
|
|
11162
11162
|
this.doSendChange({
|
|
@@ -11436,7 +11436,7 @@ var require_notebook = __commonJS({
|
|
|
11436
11436
|
this.client = client2;
|
|
11437
11437
|
this.registrations = /* @__PURE__ */ new Map();
|
|
11438
11438
|
this.registrationType = proto.NotebookDocumentSyncRegistrationType.type;
|
|
11439
|
-
|
|
11439
|
+
vscode2.workspace.onDidOpenTextDocument((textDocument) => {
|
|
11440
11440
|
if (textDocument.uri.scheme !== _NotebookDocumentSyncFeature.CellScheme) {
|
|
11441
11441
|
return;
|
|
11442
11442
|
}
|
|
@@ -11450,7 +11450,7 @@ var require_notebook = __commonJS({
|
|
|
11450
11450
|
}
|
|
11451
11451
|
}
|
|
11452
11452
|
});
|
|
11453
|
-
|
|
11453
|
+
vscode2.workspace.onDidChangeTextDocument((event) => {
|
|
11454
11454
|
if (event.contentChanges.length === 0) {
|
|
11455
11455
|
return;
|
|
11456
11456
|
}
|
|
@@ -11468,7 +11468,7 @@ var require_notebook = __commonJS({
|
|
|
11468
11468
|
}
|
|
11469
11469
|
}
|
|
11470
11470
|
});
|
|
11471
|
-
|
|
11471
|
+
vscode2.workspace.onDidCloseTextDocument((textDocument) => {
|
|
11472
11472
|
if (textDocument.uri.scheme !== _NotebookDocumentSyncFeature.CellScheme) {
|
|
11473
11473
|
return;
|
|
11474
11474
|
}
|
|
@@ -11534,7 +11534,7 @@ var require_notebook = __commonJS({
|
|
|
11534
11534
|
if (textDocument.uri.scheme !== _NotebookDocumentSyncFeature.CellScheme) {
|
|
11535
11535
|
return false;
|
|
11536
11536
|
}
|
|
11537
|
-
if (this.dedicatedChannel !== void 0 &&
|
|
11537
|
+
if (this.dedicatedChannel !== void 0 && vscode2.languages.match(this.dedicatedChannel, textDocument) > 0) {
|
|
11538
11538
|
return true;
|
|
11539
11539
|
}
|
|
11540
11540
|
for (const provider of this.registrations.values()) {
|
|
@@ -11554,7 +11554,7 @@ var require_notebook = __commonJS({
|
|
|
11554
11554
|
}
|
|
11555
11555
|
findNotebookDocumentAndCell(textDocument) {
|
|
11556
11556
|
const uri = textDocument.uri.toString();
|
|
11557
|
-
for (const notebookDocument of
|
|
11557
|
+
for (const notebookDocument of vscode2.workspace.notebookDocuments) {
|
|
11558
11558
|
for (const cell of notebookDocument.getCells()) {
|
|
11559
11559
|
if (cell.document.uri.toString() === uri) {
|
|
11560
11560
|
return [notebookDocument, cell];
|
|
@@ -14073,7 +14073,7 @@ var require_semanticTokens = __commonJS({
|
|
|
14073
14073
|
"use strict";
|
|
14074
14074
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14075
14075
|
exports2.SemanticTokensFeature = void 0;
|
|
14076
|
-
var
|
|
14076
|
+
var vscode2 = require("vscode");
|
|
14077
14077
|
var vscode_languageserver_protocol_1 = require_main3();
|
|
14078
14078
|
var features_1 = require_features();
|
|
14079
14079
|
var Is = require_is();
|
|
@@ -14151,7 +14151,7 @@ var require_semanticTokens = __commonJS({
|
|
|
14151
14151
|
const selector = options.documentSelector;
|
|
14152
14152
|
const fullProvider = Is.boolean(options.full) ? options.full : options.full !== void 0;
|
|
14153
14153
|
const hasEditProvider = options.full !== void 0 && typeof options.full !== "boolean" && options.full.delta === true;
|
|
14154
|
-
const eventEmitter = new
|
|
14154
|
+
const eventEmitter = new vscode2.EventEmitter();
|
|
14155
14155
|
const documentProvider = fullProvider ? {
|
|
14156
14156
|
onDidChangeSemanticTokens: eventEmitter.event,
|
|
14157
14157
|
provideDocumentSemanticTokens: (document, token) => {
|
|
@@ -14223,12 +14223,12 @@ var require_semanticTokens = __commonJS({
|
|
|
14223
14223
|
const legend = client2.protocol2CodeConverter.asSemanticTokensLegend(options.legend);
|
|
14224
14224
|
const documentSelector = client2.protocol2CodeConverter.asDocumentSelector(selector);
|
|
14225
14225
|
if (documentProvider !== void 0) {
|
|
14226
|
-
disposables.push(
|
|
14226
|
+
disposables.push(vscode2.languages.registerDocumentSemanticTokensProvider(documentSelector, documentProvider, legend));
|
|
14227
14227
|
}
|
|
14228
14228
|
if (rangeProvider !== void 0) {
|
|
14229
|
-
disposables.push(
|
|
14229
|
+
disposables.push(vscode2.languages.registerDocumentRangeSemanticTokensProvider(documentSelector, rangeProvider, legend));
|
|
14230
14230
|
}
|
|
14231
|
-
return [new
|
|
14231
|
+
return [new vscode2.Disposable(() => disposables.forEach((item) => item.dispose())), { range: rangeProvider, full: documentProvider, onDidChangeSemanticTokensEmitter: eventEmitter }];
|
|
14232
14232
|
}
|
|
14233
14233
|
};
|
|
14234
14234
|
exports2.SemanticTokensFeature = SemanticTokensFeature;
|
|
@@ -14952,12 +14952,12 @@ var require_client = __commonJS({
|
|
|
14952
14952
|
CloseAction2[CloseAction2["DoNotRestart"] = 1] = "DoNotRestart";
|
|
14953
14953
|
CloseAction2[CloseAction2["Restart"] = 2] = "Restart";
|
|
14954
14954
|
})(CloseAction || (exports2.CloseAction = CloseAction = {}));
|
|
14955
|
-
var
|
|
14956
|
-
(function(
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
})(
|
|
14955
|
+
var State2;
|
|
14956
|
+
(function(State3) {
|
|
14957
|
+
State3[State3["Stopped"] = 1] = "Stopped";
|
|
14958
|
+
State3[State3["Starting"] = 3] = "Starting";
|
|
14959
|
+
State3[State3["Running"] = 2] = "Running";
|
|
14960
|
+
})(State2 || (exports2.State = State2 = {}));
|
|
14961
14961
|
var SuspendMode;
|
|
14962
14962
|
(function(SuspendMode2) {
|
|
14963
14963
|
SuspendMode2["off"] = "off";
|
|
@@ -15162,11 +15162,11 @@ var require_client = __commonJS({
|
|
|
15162
15162
|
getPublicState() {
|
|
15163
15163
|
switch (this.$state) {
|
|
15164
15164
|
case ClientState.Starting:
|
|
15165
|
-
return
|
|
15165
|
+
return State2.Starting;
|
|
15166
15166
|
case ClientState.Running:
|
|
15167
|
-
return
|
|
15167
|
+
return State2.Running;
|
|
15168
15168
|
default:
|
|
15169
|
-
return
|
|
15169
|
+
return State2.Stopped;
|
|
15170
15170
|
}
|
|
15171
15171
|
}
|
|
15172
15172
|
get initializeResult() {
|
|
@@ -18063,6 +18063,2784 @@ var require_node3 = __commonJS({
|
|
|
18063
18063
|
}
|
|
18064
18064
|
});
|
|
18065
18065
|
|
|
18066
|
+
// node_modules/sprotty-vscode-protocol/lib/lsp/editing/editing.js
|
|
18067
|
+
var require_editing = __commonJS({
|
|
18068
|
+
"node_modules/sprotty-vscode-protocol/lib/lsp/editing/editing.js"(exports2) {
|
|
18069
|
+
"use strict";
|
|
18070
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18071
|
+
exports2.DeleteWithWorkspaceEditAction = exports2.WorkspaceEditAction = exports2.LspLabelEditAction = void 0;
|
|
18072
|
+
var LspLabelEditAction;
|
|
18073
|
+
(function(LspLabelEditAction2) {
|
|
18074
|
+
LspLabelEditAction2.KIND = "languageLabelEdit";
|
|
18075
|
+
function is(action) {
|
|
18076
|
+
return action.kind === LspLabelEditAction2.KIND;
|
|
18077
|
+
}
|
|
18078
|
+
LspLabelEditAction2.is = is;
|
|
18079
|
+
})(LspLabelEditAction || (exports2.LspLabelEditAction = LspLabelEditAction = {}));
|
|
18080
|
+
var WorkspaceEditAction;
|
|
18081
|
+
(function(WorkspaceEditAction2) {
|
|
18082
|
+
WorkspaceEditAction2.KIND = "workspaceEdit";
|
|
18083
|
+
function is(action) {
|
|
18084
|
+
return action.kind === WorkspaceEditAction2.KIND;
|
|
18085
|
+
}
|
|
18086
|
+
WorkspaceEditAction2.is = is;
|
|
18087
|
+
})(WorkspaceEditAction || (exports2.WorkspaceEditAction = WorkspaceEditAction = {}));
|
|
18088
|
+
var DeleteWithWorkspaceEditAction;
|
|
18089
|
+
(function(DeleteWithWorkspaceEditAction2) {
|
|
18090
|
+
DeleteWithWorkspaceEditAction2.KIND = "deleteWithWorkspaceEdit";
|
|
18091
|
+
function is(action) {
|
|
18092
|
+
return action.kind === DeleteWithWorkspaceEditAction2.KIND;
|
|
18093
|
+
}
|
|
18094
|
+
DeleteWithWorkspaceEditAction2.is = is;
|
|
18095
|
+
})(DeleteWithWorkspaceEditAction || (exports2.DeleteWithWorkspaceEditAction = DeleteWithWorkspaceEditAction = {}));
|
|
18096
|
+
}
|
|
18097
|
+
});
|
|
18098
|
+
|
|
18099
|
+
// node_modules/sprotty-vscode-protocol/lib/lsp/editing/index.js
|
|
18100
|
+
var require_editing2 = __commonJS({
|
|
18101
|
+
"node_modules/sprotty-vscode-protocol/lib/lsp/editing/index.js"(exports2) {
|
|
18102
|
+
"use strict";
|
|
18103
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
18104
|
+
if (k2 === void 0)
|
|
18105
|
+
k2 = k;
|
|
18106
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18107
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18108
|
+
desc = { enumerable: true, get: function() {
|
|
18109
|
+
return m[k];
|
|
18110
|
+
} };
|
|
18111
|
+
}
|
|
18112
|
+
Object.defineProperty(o, k2, desc);
|
|
18113
|
+
} : function(o, m, k, k2) {
|
|
18114
|
+
if (k2 === void 0)
|
|
18115
|
+
k2 = k;
|
|
18116
|
+
o[k2] = m[k];
|
|
18117
|
+
});
|
|
18118
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
18119
|
+
for (var p in m)
|
|
18120
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
18121
|
+
__createBinding(exports3, m, p);
|
|
18122
|
+
};
|
|
18123
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18124
|
+
__exportStar(require_editing(), exports2);
|
|
18125
|
+
}
|
|
18126
|
+
});
|
|
18127
|
+
|
|
18128
|
+
// node_modules/sprotty-vscode/lib/default-contributions.js
|
|
18129
|
+
var require_default_contributions = __commonJS({
|
|
18130
|
+
"node_modules/sprotty-vscode/lib/default-contributions.js"(exports2) {
|
|
18131
|
+
"use strict";
|
|
18132
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18133
|
+
exports2.registerLspEditCommands = exports2.registerTextEditorSync = exports2.registerDefaultCommands = void 0;
|
|
18134
|
+
var editing_1 = require_editing2();
|
|
18135
|
+
var vscode2 = require("vscode");
|
|
18136
|
+
function registerDefaultCommands2(manager, context, options) {
|
|
18137
|
+
function getURI(commandArgs) {
|
|
18138
|
+
if (commandArgs.length > 0 && commandArgs[0] instanceof vscode2.Uri) {
|
|
18139
|
+
return commandArgs[0];
|
|
18140
|
+
}
|
|
18141
|
+
if (vscode2.window.activeTextEditor) {
|
|
18142
|
+
return vscode2.window.activeTextEditor.document.uri;
|
|
18143
|
+
}
|
|
18144
|
+
return void 0;
|
|
18145
|
+
}
|
|
18146
|
+
context.subscriptions.push(vscode2.commands.registerCommand(options.extensionPrefix + ".diagram.open", async (...commandArgs) => {
|
|
18147
|
+
const uri = getURI(commandArgs);
|
|
18148
|
+
if (uri) {
|
|
18149
|
+
manager.openDiagram(uri, { reveal: true });
|
|
18150
|
+
}
|
|
18151
|
+
}));
|
|
18152
|
+
context.subscriptions.push(vscode2.commands.registerCommand(options.extensionPrefix + ".diagram.fit", () => {
|
|
18153
|
+
const activeWebview = manager.findActiveWebview();
|
|
18154
|
+
if (activeWebview) {
|
|
18155
|
+
activeWebview.sendAction({
|
|
18156
|
+
kind: "fit",
|
|
18157
|
+
elementIds: [],
|
|
18158
|
+
animate: true
|
|
18159
|
+
});
|
|
18160
|
+
}
|
|
18161
|
+
}));
|
|
18162
|
+
context.subscriptions.push(vscode2.commands.registerCommand(options.extensionPrefix + ".diagram.center", () => {
|
|
18163
|
+
const activeWebview = manager.findActiveWebview();
|
|
18164
|
+
if (activeWebview) {
|
|
18165
|
+
activeWebview.sendAction({
|
|
18166
|
+
kind: "center",
|
|
18167
|
+
elementIds: [],
|
|
18168
|
+
animate: true
|
|
18169
|
+
});
|
|
18170
|
+
}
|
|
18171
|
+
}));
|
|
18172
|
+
context.subscriptions.push(vscode2.commands.registerCommand(options.extensionPrefix + ".diagram.export", () => {
|
|
18173
|
+
const activeWebview = manager.findActiveWebview();
|
|
18174
|
+
if (activeWebview) {
|
|
18175
|
+
activeWebview.sendAction({
|
|
18176
|
+
kind: "requestExportSvg"
|
|
18177
|
+
});
|
|
18178
|
+
}
|
|
18179
|
+
}));
|
|
18180
|
+
}
|
|
18181
|
+
exports2.registerDefaultCommands = registerDefaultCommands2;
|
|
18182
|
+
function registerTextEditorSync2(manager, context) {
|
|
18183
|
+
context.subscriptions.push(vscode2.window.onDidChangeActiveTextEditor(async (editor) => {
|
|
18184
|
+
if (editor) {
|
|
18185
|
+
manager.openDiagram(editor.document.uri);
|
|
18186
|
+
}
|
|
18187
|
+
}));
|
|
18188
|
+
}
|
|
18189
|
+
exports2.registerTextEditorSync = registerTextEditorSync2;
|
|
18190
|
+
function registerLspEditCommands(manager, context, options) {
|
|
18191
|
+
context.subscriptions.push(vscode2.commands.registerCommand(options.extensionPrefix + ".diagram.delete", () => {
|
|
18192
|
+
const activeWebview = manager.findActiveWebview();
|
|
18193
|
+
if (activeWebview) {
|
|
18194
|
+
activeWebview.sendAction({
|
|
18195
|
+
kind: editing_1.DeleteWithWorkspaceEditAction.KIND
|
|
18196
|
+
});
|
|
18197
|
+
}
|
|
18198
|
+
}));
|
|
18199
|
+
}
|
|
18200
|
+
exports2.registerLspEditCommands = registerLspEditCommands;
|
|
18201
|
+
}
|
|
18202
|
+
});
|
|
18203
|
+
|
|
18204
|
+
// node_modules/vscode-messenger-common/lib/messages.js
|
|
18205
|
+
var require_messages3 = __commonJS({
|
|
18206
|
+
"node_modules/vscode-messenger-common/lib/messages.js"(exports2) {
|
|
18207
|
+
"use strict";
|
|
18208
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18209
|
+
exports2.isNotificationMessage = exports2.isResponseMessage = exports2.isRequestMessage = exports2.isMessage = exports2.equalParticipants = exports2.BROADCAST = exports2.isWebviewTypeMessageParticipant = exports2.isWebviewIdMessageParticipant = exports2.HOST_EXTENSION = void 0;
|
|
18210
|
+
exports2.HOST_EXTENSION = { type: "extension" };
|
|
18211
|
+
function isWebviewIdMessageParticipant(participant) {
|
|
18212
|
+
return participant.type === "webview" && typeof participant.webviewId === "string";
|
|
18213
|
+
}
|
|
18214
|
+
exports2.isWebviewIdMessageParticipant = isWebviewIdMessageParticipant;
|
|
18215
|
+
function isWebviewTypeMessageParticipant(participant) {
|
|
18216
|
+
return participant.type === "webview" && typeof participant.webviewType === "string";
|
|
18217
|
+
}
|
|
18218
|
+
exports2.isWebviewTypeMessageParticipant = isWebviewTypeMessageParticipant;
|
|
18219
|
+
exports2.BROADCAST = { type: "broadcast" };
|
|
18220
|
+
function equalParticipants(p1, p2) {
|
|
18221
|
+
if (p1.type === "extension" && p2.type === "extension") {
|
|
18222
|
+
return p1.extensionId === p2.extensionId;
|
|
18223
|
+
}
|
|
18224
|
+
if (p1.type === "webview" && p2.type === "webview") {
|
|
18225
|
+
if (isWebviewIdMessageParticipant(p1) && isWebviewIdMessageParticipant(p2)) {
|
|
18226
|
+
return p1.webviewId === p2.webviewId;
|
|
18227
|
+
}
|
|
18228
|
+
if (isWebviewTypeMessageParticipant(p1) && isWebviewTypeMessageParticipant(p2)) {
|
|
18229
|
+
return p1.webviewType === p2.webviewType;
|
|
18230
|
+
}
|
|
18231
|
+
}
|
|
18232
|
+
return p1.type === p2.type;
|
|
18233
|
+
}
|
|
18234
|
+
exports2.equalParticipants = equalParticipants;
|
|
18235
|
+
function isMessage(obj) {
|
|
18236
|
+
return typeof obj === "object" && obj !== null && typeof obj.receiver === "object";
|
|
18237
|
+
}
|
|
18238
|
+
exports2.isMessage = isMessage;
|
|
18239
|
+
function isRequestMessage(msg) {
|
|
18240
|
+
return !!msg.id && !!msg.method;
|
|
18241
|
+
}
|
|
18242
|
+
exports2.isRequestMessage = isRequestMessage;
|
|
18243
|
+
function isResponseMessage(msg) {
|
|
18244
|
+
return !!msg.id && !msg.method;
|
|
18245
|
+
}
|
|
18246
|
+
exports2.isResponseMessage = isResponseMessage;
|
|
18247
|
+
function isNotificationMessage(msg) {
|
|
18248
|
+
return !msg.id && !!msg.method;
|
|
18249
|
+
}
|
|
18250
|
+
exports2.isNotificationMessage = isNotificationMessage;
|
|
18251
|
+
}
|
|
18252
|
+
});
|
|
18253
|
+
|
|
18254
|
+
// node_modules/vscode-messenger-common/lib/index.js
|
|
18255
|
+
var require_lib = __commonJS({
|
|
18256
|
+
"node_modules/vscode-messenger-common/lib/index.js"(exports2) {
|
|
18257
|
+
"use strict";
|
|
18258
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
18259
|
+
if (k2 === void 0)
|
|
18260
|
+
k2 = k;
|
|
18261
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18262
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18263
|
+
desc = { enumerable: true, get: function() {
|
|
18264
|
+
return m[k];
|
|
18265
|
+
} };
|
|
18266
|
+
}
|
|
18267
|
+
Object.defineProperty(o, k2, desc);
|
|
18268
|
+
} : function(o, m, k, k2) {
|
|
18269
|
+
if (k2 === void 0)
|
|
18270
|
+
k2 = k;
|
|
18271
|
+
o[k2] = m[k];
|
|
18272
|
+
});
|
|
18273
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
18274
|
+
for (var p in m)
|
|
18275
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
18276
|
+
__createBinding(exports3, m, p);
|
|
18277
|
+
};
|
|
18278
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18279
|
+
__exportStar(require_messages3(), exports2);
|
|
18280
|
+
}
|
|
18281
|
+
});
|
|
18282
|
+
|
|
18283
|
+
// node_modules/vscode-messenger/lib/messenger.js
|
|
18284
|
+
var require_messenger = __commonJS({
|
|
18285
|
+
"node_modules/vscode-messenger/lib/messenger.js"(exports2) {
|
|
18286
|
+
"use strict";
|
|
18287
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18288
|
+
exports2.Messenger = void 0;
|
|
18289
|
+
var vscode_messenger_common_1 = require_lib();
|
|
18290
|
+
var Messenger2 = class {
|
|
18291
|
+
constructor(options) {
|
|
18292
|
+
this.idProvider = new IdProvider();
|
|
18293
|
+
this.viewTypeRegistry = /* @__PURE__ */ new Map();
|
|
18294
|
+
this.viewRegistry = /* @__PURE__ */ new Map();
|
|
18295
|
+
this.handlerRegistry = /* @__PURE__ */ new Map();
|
|
18296
|
+
this.requests = /* @__PURE__ */ new Map();
|
|
18297
|
+
this.eventListeners = /* @__PURE__ */ new Map();
|
|
18298
|
+
this.nextMsgId = 0;
|
|
18299
|
+
const defaultOptions = {
|
|
18300
|
+
ignoreHiddenViews: true,
|
|
18301
|
+
debugLog: false
|
|
18302
|
+
};
|
|
18303
|
+
this.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
18304
|
+
}
|
|
18305
|
+
registerWebviewPanel(panel, options = {}) {
|
|
18306
|
+
return this.registerViewContainer(panel, options);
|
|
18307
|
+
}
|
|
18308
|
+
registerWebviewView(view, options = {}) {
|
|
18309
|
+
return this.registerViewContainer(view, options);
|
|
18310
|
+
}
|
|
18311
|
+
registerViewContainer(view, options) {
|
|
18312
|
+
const viewTypeEntry = this.viewTypeRegistry.get(view.viewType);
|
|
18313
|
+
if (viewTypeEntry) {
|
|
18314
|
+
viewTypeEntry.add(view);
|
|
18315
|
+
} else {
|
|
18316
|
+
this.viewTypeRegistry.set(view.viewType, /* @__PURE__ */ new Set([view]));
|
|
18317
|
+
}
|
|
18318
|
+
const viewEntry = {
|
|
18319
|
+
id: this.idProvider.getWebviewId(view),
|
|
18320
|
+
container: view,
|
|
18321
|
+
options
|
|
18322
|
+
};
|
|
18323
|
+
this.viewRegistry.set(viewEntry.id, viewEntry);
|
|
18324
|
+
const viewType = view.viewType;
|
|
18325
|
+
view.onDidDispose(() => {
|
|
18326
|
+
var _a;
|
|
18327
|
+
this.viewRegistry.delete(viewEntry.id);
|
|
18328
|
+
const removed = (_a = this.viewTypeRegistry.get(viewType)) === null || _a === void 0 ? void 0 : _a.delete(view);
|
|
18329
|
+
if (!removed) {
|
|
18330
|
+
this.log(`Attempt to remove non-existing registry entry for View: ${viewEntry.id} (type ${viewType})`, "warn");
|
|
18331
|
+
}
|
|
18332
|
+
});
|
|
18333
|
+
view.webview.onDidReceiveMessage(async (msg) => {
|
|
18334
|
+
if ((0, vscode_messenger_common_1.isMessage)(msg)) {
|
|
18335
|
+
if (!msg.sender) {
|
|
18336
|
+
msg.sender = {
|
|
18337
|
+
type: "webview",
|
|
18338
|
+
webviewId: viewEntry.id,
|
|
18339
|
+
webviewType: view.viewType
|
|
18340
|
+
};
|
|
18341
|
+
}
|
|
18342
|
+
return this.processMessage(msg, (res) => {
|
|
18343
|
+
this.notifyEventListeners(res);
|
|
18344
|
+
return view.webview.postMessage(res);
|
|
18345
|
+
}).catch((err) => this.log(String(err), "error"));
|
|
18346
|
+
}
|
|
18347
|
+
});
|
|
18348
|
+
return {
|
|
18349
|
+
type: "webview",
|
|
18350
|
+
webviewId: viewEntry.id
|
|
18351
|
+
};
|
|
18352
|
+
}
|
|
18353
|
+
/**
|
|
18354
|
+
* Process an incoming message by forwarding it to the respective receiver or handling it with
|
|
18355
|
+
* a locally registered message handler.
|
|
18356
|
+
*/
|
|
18357
|
+
async processMessage(msg, responseCallback) {
|
|
18358
|
+
this.notifyEventListeners(msg);
|
|
18359
|
+
if (msg.receiver.type === "extension") {
|
|
18360
|
+
if ((0, vscode_messenger_common_1.isRequestMessage)(msg)) {
|
|
18361
|
+
await this.processRequestMessage(msg, responseCallback);
|
|
18362
|
+
} else if ((0, vscode_messenger_common_1.isNotificationMessage)(msg)) {
|
|
18363
|
+
await this.processNotificationMessage(msg);
|
|
18364
|
+
} else if ((0, vscode_messenger_common_1.isResponseMessage)(msg)) {
|
|
18365
|
+
await this.processResponseMessage(msg);
|
|
18366
|
+
} else {
|
|
18367
|
+
this.log(`Invalid message: ${JSON.stringify(msg)}`, "error");
|
|
18368
|
+
}
|
|
18369
|
+
} else if (msg.receiver.type === "webview") {
|
|
18370
|
+
if ((0, vscode_messenger_common_1.isWebviewIdMessageParticipant)(msg.receiver)) {
|
|
18371
|
+
const receiverView = this.viewRegistry.get(msg.receiver.webviewId);
|
|
18372
|
+
if (receiverView) {
|
|
18373
|
+
const result = await receiverView.container.webview.postMessage(msg);
|
|
18374
|
+
if (!result) {
|
|
18375
|
+
this.log(`Failed to forward message to view: ${msg.receiver.webviewId}`, "error");
|
|
18376
|
+
}
|
|
18377
|
+
} else {
|
|
18378
|
+
this.log(`No webview with id ${msg.receiver.webviewId} is registered.`, "warn");
|
|
18379
|
+
}
|
|
18380
|
+
} else if (msg.receiver.webviewType) {
|
|
18381
|
+
const webViewType = msg.receiver.webviewType;
|
|
18382
|
+
const receiverViews = this.viewTypeRegistry.get(webViewType);
|
|
18383
|
+
if (receiverViews) {
|
|
18384
|
+
receiverViews.forEach(async (view) => {
|
|
18385
|
+
const result = await view.webview.postMessage(msg);
|
|
18386
|
+
if (!result) {
|
|
18387
|
+
this.log(`Failed to forward message to view: ${webViewType}`, "error");
|
|
18388
|
+
}
|
|
18389
|
+
});
|
|
18390
|
+
} else {
|
|
18391
|
+
this.log(`No webview with type ${webViewType} is registered.`, "warn");
|
|
18392
|
+
}
|
|
18393
|
+
} else {
|
|
18394
|
+
this.log(`A receiver of type 'webview' must specify a 'webviewId' or a 'webviewType': ${JSON.stringify(msg)}`, "error");
|
|
18395
|
+
}
|
|
18396
|
+
} else if (msg.receiver.type === "broadcast") {
|
|
18397
|
+
if ((0, vscode_messenger_common_1.isNotificationMessage)(msg)) {
|
|
18398
|
+
for (const view of this.viewRegistry.values()) {
|
|
18399
|
+
if (view.options.broadcastMethods && view.options.broadcastMethods.indexOf(msg.method) >= 0) {
|
|
18400
|
+
view.container.webview.postMessage(msg);
|
|
18401
|
+
}
|
|
18402
|
+
}
|
|
18403
|
+
await this.processNotificationMessage(msg);
|
|
18404
|
+
} else {
|
|
18405
|
+
this.log(`Only notification messages are allowed for broadcast: ${JSON.stringify(msg)}`, "error");
|
|
18406
|
+
}
|
|
18407
|
+
}
|
|
18408
|
+
}
|
|
18409
|
+
/**
|
|
18410
|
+
* Process an incoming request message with a registered handler.
|
|
18411
|
+
*/
|
|
18412
|
+
async processRequestMessage(msg, responseCallback) {
|
|
18413
|
+
this.log(`Host received Request message: ${msg.method} (id ${msg.id})`);
|
|
18414
|
+
const regs = this.handlerRegistry.get(msg.method);
|
|
18415
|
+
if (!regs) {
|
|
18416
|
+
this.log(`Received request with unknown method: ${msg.method}`, "warn");
|
|
18417
|
+
return this.sendErrorResponse(`Unknown method: ${msg.method}`, msg, responseCallback);
|
|
18418
|
+
}
|
|
18419
|
+
const filtered = regs.filter((reg) => !reg.sender || (0, vscode_messenger_common_1.equalParticipants)(reg.sender, msg.sender));
|
|
18420
|
+
if (filtered.length === 0) {
|
|
18421
|
+
this.log(`No request handler for ${msg.method} matching sender: ${participantToString(msg.sender)}`, "warn");
|
|
18422
|
+
return this.sendErrorResponse("No matching request handler", msg, responseCallback);
|
|
18423
|
+
}
|
|
18424
|
+
if (filtered.length > 1) {
|
|
18425
|
+
this.log(`Multiple request handlers for ${msg.method} matching sender: ${participantToString(msg.sender)}`, "warn");
|
|
18426
|
+
return this.sendErrorResponse("Multiple matching request handlers", msg, responseCallback);
|
|
18427
|
+
}
|
|
18428
|
+
try {
|
|
18429
|
+
const result = await filtered[0].handler(msg.params, msg.sender);
|
|
18430
|
+
const response = {
|
|
18431
|
+
id: msg.id,
|
|
18432
|
+
sender: vscode_messenger_common_1.HOST_EXTENSION,
|
|
18433
|
+
receiver: msg.sender,
|
|
18434
|
+
result
|
|
18435
|
+
};
|
|
18436
|
+
const posted = await responseCallback(response);
|
|
18437
|
+
if (!posted) {
|
|
18438
|
+
this.log(`Failed to send result message: ${participantToString(response.receiver)}`, "error");
|
|
18439
|
+
}
|
|
18440
|
+
} catch (error) {
|
|
18441
|
+
this.sendErrorResponse(this.createResponseError(error), msg, responseCallback);
|
|
18442
|
+
}
|
|
18443
|
+
}
|
|
18444
|
+
async sendErrorResponse(error, msg, responseCallback) {
|
|
18445
|
+
const response = {
|
|
18446
|
+
id: msg.id,
|
|
18447
|
+
sender: vscode_messenger_common_1.HOST_EXTENSION,
|
|
18448
|
+
receiver: msg.sender,
|
|
18449
|
+
error: typeof error === "string" ? { message: error } : error
|
|
18450
|
+
};
|
|
18451
|
+
const posted = await responseCallback(response);
|
|
18452
|
+
if (!posted) {
|
|
18453
|
+
this.log(`Failed to send error message: ${participantToString(response.receiver)}`, "error");
|
|
18454
|
+
}
|
|
18455
|
+
}
|
|
18456
|
+
createResponseError(error) {
|
|
18457
|
+
if (error instanceof Error) {
|
|
18458
|
+
return { message: error.message, data: error.stack };
|
|
18459
|
+
} else if (typeof error === "object" && error !== null && typeof error.message === "string") {
|
|
18460
|
+
return { message: error.message, data: error.data };
|
|
18461
|
+
} else {
|
|
18462
|
+
return { message: String(error) };
|
|
18463
|
+
}
|
|
18464
|
+
}
|
|
18465
|
+
/**
|
|
18466
|
+
* Process an incoming notification message with a registered handler.
|
|
18467
|
+
*/
|
|
18468
|
+
async processNotificationMessage(msg) {
|
|
18469
|
+
this.log(`Host received Notification message: ${msg.method}`);
|
|
18470
|
+
const regs = this.handlerRegistry.get(msg.method);
|
|
18471
|
+
if (regs) {
|
|
18472
|
+
const filtered = regs.filter((reg) => !reg.sender || (0, vscode_messenger_common_1.equalParticipants)(reg.sender, msg.sender));
|
|
18473
|
+
if (filtered.length > 0) {
|
|
18474
|
+
await Promise.all(filtered.map((reg) => reg.handler(msg.params, msg.sender)));
|
|
18475
|
+
}
|
|
18476
|
+
} else if (msg.receiver.type !== "broadcast") {
|
|
18477
|
+
this.log(`Received notification with unknown method: ${msg.method}`, "warn");
|
|
18478
|
+
}
|
|
18479
|
+
}
|
|
18480
|
+
/**
|
|
18481
|
+
* Process an incoming response message by resolving or rejecting the associated promise.
|
|
18482
|
+
*/
|
|
18483
|
+
async processResponseMessage(msg) {
|
|
18484
|
+
this.log(`Host received Response message: ${msg.id} `);
|
|
18485
|
+
const request = this.requests.get(msg.id);
|
|
18486
|
+
if (request) {
|
|
18487
|
+
if (msg.error) {
|
|
18488
|
+
request.reject(msg.error);
|
|
18489
|
+
} else {
|
|
18490
|
+
request.resolve(msg.result);
|
|
18491
|
+
}
|
|
18492
|
+
this.requests.delete(msg.id);
|
|
18493
|
+
} else {
|
|
18494
|
+
this.log(`Received response for untracked message id: ${msg.id} (participant: ${participantToString(msg.sender)})`, "warn");
|
|
18495
|
+
}
|
|
18496
|
+
}
|
|
18497
|
+
onRequest(type, handler, options = {}) {
|
|
18498
|
+
return this.registerHandler(type, handler, options);
|
|
18499
|
+
}
|
|
18500
|
+
onNotification(type, handler, options = {}) {
|
|
18501
|
+
return this.registerHandler(type, handler, options);
|
|
18502
|
+
}
|
|
18503
|
+
registerHandler(type, handler, options) {
|
|
18504
|
+
let handlers = this.handlerRegistry.get(type.method);
|
|
18505
|
+
if (handlers && this.options.uniqueHandlers) {
|
|
18506
|
+
throw new Error(`A message handler is already registered for method ${type.method}.`);
|
|
18507
|
+
}
|
|
18508
|
+
if (!handlers) {
|
|
18509
|
+
handlers = [];
|
|
18510
|
+
this.handlerRegistry.set(type.method, handlers);
|
|
18511
|
+
}
|
|
18512
|
+
const registration = { handler, sender: options.sender };
|
|
18513
|
+
handlers.push(registration);
|
|
18514
|
+
return {
|
|
18515
|
+
dispose: () => {
|
|
18516
|
+
const handlers2 = this.handlerRegistry.get(type.method);
|
|
18517
|
+
if (handlers2) {
|
|
18518
|
+
const index = handlers2.indexOf(registration);
|
|
18519
|
+
if (index >= 0) {
|
|
18520
|
+
handlers2.splice(index, 1);
|
|
18521
|
+
if (handlers2.length === 0) {
|
|
18522
|
+
this.handlerRegistry.delete(type.method);
|
|
18523
|
+
}
|
|
18524
|
+
}
|
|
18525
|
+
}
|
|
18526
|
+
}
|
|
18527
|
+
};
|
|
18528
|
+
}
|
|
18529
|
+
async sendRequest(type, receiver, params) {
|
|
18530
|
+
if (receiver.type === "extension") {
|
|
18531
|
+
throw new Error("Requests to other extensions are not supported yet.");
|
|
18532
|
+
} else if (receiver.type === "webview") {
|
|
18533
|
+
if ((0, vscode_messenger_common_1.isWebviewIdMessageParticipant)(receiver)) {
|
|
18534
|
+
const receiverView = this.viewRegistry.get(receiver.webviewId);
|
|
18535
|
+
if (receiverView) {
|
|
18536
|
+
return this.sendRequestToWebview(type, receiver, params, receiverView.container);
|
|
18537
|
+
} else {
|
|
18538
|
+
return Promise.reject(new Error(`No webview with id ${receiver.webviewId} is registered.`));
|
|
18539
|
+
}
|
|
18540
|
+
} else if (receiver.webviewType) {
|
|
18541
|
+
const receiverViews = this.viewTypeRegistry.get(receiver.webviewType);
|
|
18542
|
+
if (receiverViews) {
|
|
18543
|
+
const results = Array.from(receiverViews).map((view) => this.sendRequestToWebview(type, receiver, params, view));
|
|
18544
|
+
return Promise.race(results);
|
|
18545
|
+
} else {
|
|
18546
|
+
return Promise.reject(new Error(`No webview with type ${receiver.webviewType} is registered.`));
|
|
18547
|
+
}
|
|
18548
|
+
} else {
|
|
18549
|
+
throw new Error("Unspecified webview receiver: neither webviewId nor webviewType was set.");
|
|
18550
|
+
}
|
|
18551
|
+
} else if (receiver.type === "broadcast") {
|
|
18552
|
+
throw new Error("Only notification messages are allowed for broadcast.");
|
|
18553
|
+
}
|
|
18554
|
+
throw new Error(`Invalid receiver: ${JSON.stringify(receiver)}`);
|
|
18555
|
+
}
|
|
18556
|
+
async sendRequestToWebview(type, receiver, params, view) {
|
|
18557
|
+
var _a;
|
|
18558
|
+
if (!view.visible && this.options.ignoreHiddenViews) {
|
|
18559
|
+
return Promise.reject(new Error(`Skipped request for hidden view: ${participantToString(receiver)}`));
|
|
18560
|
+
}
|
|
18561
|
+
const msgId = this.createMsgId();
|
|
18562
|
+
const result = new Promise((resolve, reject) => {
|
|
18563
|
+
this.requests.set(msgId, { resolve, reject });
|
|
18564
|
+
});
|
|
18565
|
+
const message = {
|
|
18566
|
+
id: msgId,
|
|
18567
|
+
method: type.method,
|
|
18568
|
+
sender: vscode_messenger_common_1.HOST_EXTENSION,
|
|
18569
|
+
receiver,
|
|
18570
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18571
|
+
params
|
|
18572
|
+
};
|
|
18573
|
+
this.notifyEventListeners(message);
|
|
18574
|
+
const posted = await view.webview.postMessage(message);
|
|
18575
|
+
if (!posted) {
|
|
18576
|
+
this.log(`Failed to send message to view: ${participantToString(receiver)}`, "error");
|
|
18577
|
+
(_a = this.requests.get(msgId)) === null || _a === void 0 ? void 0 : _a.reject(new Error(`Failed to send message to view: ${participantToString(receiver)}`));
|
|
18578
|
+
this.requests.delete(msgId);
|
|
18579
|
+
}
|
|
18580
|
+
return result;
|
|
18581
|
+
}
|
|
18582
|
+
sendNotification(type, receiver, params) {
|
|
18583
|
+
if (receiver.type === "extension") {
|
|
18584
|
+
throw new Error("Notifications to other extensions are not supported yet.");
|
|
18585
|
+
} else if (receiver.type === "webview") {
|
|
18586
|
+
if ((0, vscode_messenger_common_1.isWebviewIdMessageParticipant)(receiver)) {
|
|
18587
|
+
const receiverView = this.viewRegistry.get(receiver.webviewId);
|
|
18588
|
+
if (receiverView) {
|
|
18589
|
+
this.sendNotificationToWebview(type, receiver, params, receiverView.container).catch((err) => this.log(String(err), "error"));
|
|
18590
|
+
} else {
|
|
18591
|
+
this.log(`No webview with id ${receiver.webviewId} is registered.`, "warn");
|
|
18592
|
+
}
|
|
18593
|
+
} else if (receiver.webviewType) {
|
|
18594
|
+
const receiverViews = this.viewTypeRegistry.get(receiver.webviewType);
|
|
18595
|
+
if (receiverViews) {
|
|
18596
|
+
receiverViews.forEach((view) => {
|
|
18597
|
+
this.sendNotificationToWebview(type, receiver, params, view).catch((err) => this.log(String(err), "error"));
|
|
18598
|
+
});
|
|
18599
|
+
} else {
|
|
18600
|
+
this.log(`No webview with type ${receiver.webviewType} is registered.`, "warn");
|
|
18601
|
+
}
|
|
18602
|
+
} else {
|
|
18603
|
+
throw new Error("Unspecified webview receiver: neither webviewId nor webviewType was set.");
|
|
18604
|
+
}
|
|
18605
|
+
} else if (receiver.type === "broadcast") {
|
|
18606
|
+
for (const view of this.viewRegistry.values()) {
|
|
18607
|
+
if (view.options.broadcastMethods && view.options.broadcastMethods.indexOf(type.method) >= 0) {
|
|
18608
|
+
this.sendNotificationToWebview(type, receiver, params, view.container).catch((err) => this.log(String(err), "error"));
|
|
18609
|
+
}
|
|
18610
|
+
}
|
|
18611
|
+
}
|
|
18612
|
+
}
|
|
18613
|
+
async sendNotificationToWebview(type, receiver, params, view) {
|
|
18614
|
+
if (!view.visible && this.options.ignoreHiddenViews) {
|
|
18615
|
+
this.log(`Skipped notification for hidden view: ${participantToString(receiver)}`, "debug");
|
|
18616
|
+
return;
|
|
18617
|
+
}
|
|
18618
|
+
const message = {
|
|
18619
|
+
method: type.method,
|
|
18620
|
+
sender: vscode_messenger_common_1.HOST_EXTENSION,
|
|
18621
|
+
receiver,
|
|
18622
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18623
|
+
params
|
|
18624
|
+
};
|
|
18625
|
+
this.notifyEventListeners(message);
|
|
18626
|
+
const result = await view.webview.postMessage(message);
|
|
18627
|
+
if (!result) {
|
|
18628
|
+
this.log(`Failed to send message to view: ${participantToString(receiver)}`, "error");
|
|
18629
|
+
}
|
|
18630
|
+
}
|
|
18631
|
+
async notifyEventListeners(msg) {
|
|
18632
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
18633
|
+
if (this.eventListeners.size > 0) {
|
|
18634
|
+
const event = {
|
|
18635
|
+
type: "unknown",
|
|
18636
|
+
sender: participantToString(msg.sender),
|
|
18637
|
+
receiver: participantToString(msg.receiver),
|
|
18638
|
+
size: 0,
|
|
18639
|
+
timestamp: Date.now()
|
|
18640
|
+
};
|
|
18641
|
+
if ((0, vscode_messenger_common_1.isRequestMessage)(msg)) {
|
|
18642
|
+
event.type = "request";
|
|
18643
|
+
event.id = msg.id;
|
|
18644
|
+
event.method = msg.method;
|
|
18645
|
+
event.parameter = msg.params;
|
|
18646
|
+
event.size = (_b = (_a = JSON.stringify(msg.params)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
18647
|
+
} else if ((0, vscode_messenger_common_1.isNotificationMessage)(msg)) {
|
|
18648
|
+
event.type = "notification";
|
|
18649
|
+
event.method = msg.method;
|
|
18650
|
+
event.parameter = msg.params;
|
|
18651
|
+
event.size = (_d = (_c = JSON.stringify(msg.params)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
|
|
18652
|
+
} else if ((0, vscode_messenger_common_1.isResponseMessage)(msg)) {
|
|
18653
|
+
event.type = "response";
|
|
18654
|
+
event.id = msg.id;
|
|
18655
|
+
event.size = (_f = (_e = JSON.stringify(msg.result)) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0;
|
|
18656
|
+
if (msg.error) {
|
|
18657
|
+
event.error = ((_g = msg.error) === null || _g === void 0 ? void 0 : _g.message) ? (_h = msg.error) === null || _h === void 0 ? void 0 : _h.message : "No error message provided";
|
|
18658
|
+
if (msg.error.data) {
|
|
18659
|
+
event.size += (_k = (_j = JSON.stringify(msg.error.data)) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
|
|
18660
|
+
}
|
|
18661
|
+
}
|
|
18662
|
+
} else {
|
|
18663
|
+
event.error = `Unknown message to ${msg.receiver}`;
|
|
18664
|
+
}
|
|
18665
|
+
this.eventListeners.forEach((options, listener) => {
|
|
18666
|
+
if (!(options === null || options === void 0 ? void 0 : options.withParameterData)) {
|
|
18667
|
+
event.parameter = void 0;
|
|
18668
|
+
}
|
|
18669
|
+
listener(event);
|
|
18670
|
+
});
|
|
18671
|
+
}
|
|
18672
|
+
return Promise.resolve();
|
|
18673
|
+
}
|
|
18674
|
+
/**
|
|
18675
|
+
* Exposes diagnostic api to be used by message interaction tracking tools.
|
|
18676
|
+
* True if payload data (parameter, response value) should be added to diagnostic API
|
|
18677
|
+
* @param options Configurations to control the behavior of diagnostic message provider.
|
|
18678
|
+
*/
|
|
18679
|
+
diagnosticApi(options) {
|
|
18680
|
+
return {
|
|
18681
|
+
extensionInfo: () => {
|
|
18682
|
+
return {
|
|
18683
|
+
diagnosticListeners: this.eventListeners.size,
|
|
18684
|
+
pendingRequest: this.requests.size,
|
|
18685
|
+
handlers: Array.from(this.handlerRegistry.entries()).map((entry) => {
|
|
18686
|
+
return { method: entry[0], count: entry[1].length };
|
|
18687
|
+
}),
|
|
18688
|
+
webviews: Array.from(this.viewRegistry.entries()).map((entry) => {
|
|
18689
|
+
return { id: entry[0], type: entry[1].container.viewType };
|
|
18690
|
+
})
|
|
18691
|
+
};
|
|
18692
|
+
},
|
|
18693
|
+
addEventListener: (listener) => {
|
|
18694
|
+
this.eventListeners.set(listener, options);
|
|
18695
|
+
return {
|
|
18696
|
+
dispose: () => this.eventListeners.delete(listener)
|
|
18697
|
+
};
|
|
18698
|
+
},
|
|
18699
|
+
removeEventListener: (listener) => this.eventListeners.delete(listener)
|
|
18700
|
+
};
|
|
18701
|
+
}
|
|
18702
|
+
createMsgId() {
|
|
18703
|
+
return "req_" + this.nextMsgId++;
|
|
18704
|
+
}
|
|
18705
|
+
log(text, level = "debug") {
|
|
18706
|
+
switch (level) {
|
|
18707
|
+
case "debug": {
|
|
18708
|
+
if (this.options.debugLog) {
|
|
18709
|
+
console.debug(text);
|
|
18710
|
+
}
|
|
18711
|
+
break;
|
|
18712
|
+
}
|
|
18713
|
+
case "warn": {
|
|
18714
|
+
console.warn(text);
|
|
18715
|
+
break;
|
|
18716
|
+
}
|
|
18717
|
+
case "error": {
|
|
18718
|
+
console.error(text);
|
|
18719
|
+
break;
|
|
18720
|
+
}
|
|
18721
|
+
}
|
|
18722
|
+
}
|
|
18723
|
+
};
|
|
18724
|
+
exports2.Messenger = Messenger2;
|
|
18725
|
+
var IdProvider = class {
|
|
18726
|
+
constructor() {
|
|
18727
|
+
this.counter = 0;
|
|
18728
|
+
}
|
|
18729
|
+
/**
|
|
18730
|
+
* Provide an identifier for the given webview. This should be called only once per webview
|
|
18731
|
+
* instance because the result will be different for every call.
|
|
18732
|
+
*/
|
|
18733
|
+
getWebviewId(view) {
|
|
18734
|
+
return view.viewType + "_" + this.counter++;
|
|
18735
|
+
}
|
|
18736
|
+
};
|
|
18737
|
+
function participantToString(participant) {
|
|
18738
|
+
if (!participant) {
|
|
18739
|
+
return "undefined";
|
|
18740
|
+
}
|
|
18741
|
+
switch (participant.type) {
|
|
18742
|
+
case "extension":
|
|
18743
|
+
return "host extension";
|
|
18744
|
+
case "webview":
|
|
18745
|
+
if ((0, vscode_messenger_common_1.isWebviewIdMessageParticipant)(participant)) {
|
|
18746
|
+
return participant.webviewId;
|
|
18747
|
+
} else if (participant.webviewType) {
|
|
18748
|
+
return participant.webviewType;
|
|
18749
|
+
} else {
|
|
18750
|
+
return "unspecified webview";
|
|
18751
|
+
}
|
|
18752
|
+
case "broadcast":
|
|
18753
|
+
return "broadcast";
|
|
18754
|
+
}
|
|
18755
|
+
}
|
|
18756
|
+
}
|
|
18757
|
+
});
|
|
18758
|
+
|
|
18759
|
+
// node_modules/vscode-messenger/lib/diagnostic-api.js
|
|
18760
|
+
var require_diagnostic_api = __commonJS({
|
|
18761
|
+
"node_modules/vscode-messenger/lib/diagnostic-api.js"(exports2) {
|
|
18762
|
+
"use strict";
|
|
18763
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18764
|
+
exports2.isMessengerDiagnostic = void 0;
|
|
18765
|
+
function isMessengerDiagnostic(obj) {
|
|
18766
|
+
return typeof obj === "object" && obj !== null && !!obj.extensionInfo && !!obj.addEventListener && !!obj.removeEventListener;
|
|
18767
|
+
}
|
|
18768
|
+
exports2.isMessengerDiagnostic = isMessengerDiagnostic;
|
|
18769
|
+
}
|
|
18770
|
+
});
|
|
18771
|
+
|
|
18772
|
+
// node_modules/vscode-messenger/lib/index.js
|
|
18773
|
+
var require_lib2 = __commonJS({
|
|
18774
|
+
"node_modules/vscode-messenger/lib/index.js"(exports2) {
|
|
18775
|
+
"use strict";
|
|
18776
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
18777
|
+
if (k2 === void 0)
|
|
18778
|
+
k2 = k;
|
|
18779
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18780
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18781
|
+
desc = { enumerable: true, get: function() {
|
|
18782
|
+
return m[k];
|
|
18783
|
+
} };
|
|
18784
|
+
}
|
|
18785
|
+
Object.defineProperty(o, k2, desc);
|
|
18786
|
+
} : function(o, m, k, k2) {
|
|
18787
|
+
if (k2 === void 0)
|
|
18788
|
+
k2 = k;
|
|
18789
|
+
o[k2] = m[k];
|
|
18790
|
+
});
|
|
18791
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
18792
|
+
for (var p in m)
|
|
18793
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
18794
|
+
__createBinding(exports3, m, p);
|
|
18795
|
+
};
|
|
18796
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18797
|
+
__exportStar(require_messenger(), exports2);
|
|
18798
|
+
__exportStar(require_diagnostic_api(), exports2);
|
|
18799
|
+
}
|
|
18800
|
+
});
|
|
18801
|
+
|
|
18802
|
+
// node_modules/sprotty-protocol/lib/action-handler.js
|
|
18803
|
+
var require_action_handler = __commonJS({
|
|
18804
|
+
"node_modules/sprotty-protocol/lib/action-handler.js"(exports2) {
|
|
18805
|
+
"use strict";
|
|
18806
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18807
|
+
exports2.ServerActionHandlerRegistry = void 0;
|
|
18808
|
+
var ServerActionHandlerRegistry = class {
|
|
18809
|
+
constructor() {
|
|
18810
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
18811
|
+
}
|
|
18812
|
+
/**
|
|
18813
|
+
* Returns the action handlers for the given action kind, or `undefined` if there are none.
|
|
18814
|
+
*/
|
|
18815
|
+
getHandler(kind) {
|
|
18816
|
+
return this.handlers.get(kind);
|
|
18817
|
+
}
|
|
18818
|
+
/**
|
|
18819
|
+
* Add an action handler to be called when an action of the specified kind is received.
|
|
18820
|
+
*/
|
|
18821
|
+
onAction(kind, handler) {
|
|
18822
|
+
if (this.handlers.has(kind)) {
|
|
18823
|
+
this.handlers.get(kind).push(handler);
|
|
18824
|
+
} else {
|
|
18825
|
+
this.handlers.set(kind, [handler]);
|
|
18826
|
+
}
|
|
18827
|
+
}
|
|
18828
|
+
/**
|
|
18829
|
+
* Remove an action handler that was previously added with `onAction`.
|
|
18830
|
+
*/
|
|
18831
|
+
removeActionHandler(kind, handler) {
|
|
18832
|
+
const list = this.handlers.get(kind);
|
|
18833
|
+
if (list) {
|
|
18834
|
+
const index = list.indexOf(handler);
|
|
18835
|
+
if (index >= 0) {
|
|
18836
|
+
list.splice(index, 1);
|
|
18837
|
+
}
|
|
18838
|
+
}
|
|
18839
|
+
}
|
|
18840
|
+
};
|
|
18841
|
+
exports2.ServerActionHandlerRegistry = ServerActionHandlerRegistry;
|
|
18842
|
+
}
|
|
18843
|
+
});
|
|
18844
|
+
|
|
18845
|
+
// node_modules/sprotty-protocol/lib/utils/object.js
|
|
18846
|
+
var require_object = __commonJS({
|
|
18847
|
+
"node_modules/sprotty-protocol/lib/utils/object.js"(exports2) {
|
|
18848
|
+
"use strict";
|
|
18849
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18850
|
+
exports2.safeAssign = exports2.hasOwnProperty = exports2.isObject = void 0;
|
|
18851
|
+
function isObject(data) {
|
|
18852
|
+
return typeof data === "object" && data !== null;
|
|
18853
|
+
}
|
|
18854
|
+
exports2.isObject = isObject;
|
|
18855
|
+
function hasOwnProperty(arg, key, type) {
|
|
18856
|
+
if (!isObject(arg)) {
|
|
18857
|
+
return false;
|
|
18858
|
+
}
|
|
18859
|
+
if (Array.isArray(key)) {
|
|
18860
|
+
for (const k of key) {
|
|
18861
|
+
if (!Object.prototype.hasOwnProperty.call(arg, k)) {
|
|
18862
|
+
return false;
|
|
18863
|
+
}
|
|
18864
|
+
if (typeof type === "string" && typeof arg[k] !== type) {
|
|
18865
|
+
return false;
|
|
18866
|
+
} else if (typeof type === "function" && !type(arg[k])) {
|
|
18867
|
+
return false;
|
|
18868
|
+
}
|
|
18869
|
+
}
|
|
18870
|
+
} else {
|
|
18871
|
+
if (!Object.prototype.hasOwnProperty.call(arg, key)) {
|
|
18872
|
+
return false;
|
|
18873
|
+
}
|
|
18874
|
+
if (typeof type === "string") {
|
|
18875
|
+
return typeof arg[key] === type;
|
|
18876
|
+
}
|
|
18877
|
+
if (typeof type === "function") {
|
|
18878
|
+
return type(arg[key]);
|
|
18879
|
+
}
|
|
18880
|
+
}
|
|
18881
|
+
return true;
|
|
18882
|
+
}
|
|
18883
|
+
exports2.hasOwnProperty = hasOwnProperty;
|
|
18884
|
+
function safeAssign(target, partial) {
|
|
18885
|
+
return Object.assign(target, partial);
|
|
18886
|
+
}
|
|
18887
|
+
exports2.safeAssign = safeAssign;
|
|
18888
|
+
}
|
|
18889
|
+
});
|
|
18890
|
+
|
|
18891
|
+
// node_modules/sprotty-protocol/lib/actions.js
|
|
18892
|
+
var require_actions = __commonJS({
|
|
18893
|
+
"node_modules/sprotty-protocol/lib/actions.js"(exports2) {
|
|
18894
|
+
"use strict";
|
|
18895
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18896
|
+
exports2.ReconnectAction = exports2.ApplyLabelEditAction = exports2.DeleteElementAction = exports2.CreateElementAction = exports2.ExportSvgAction = exports2.RequestExportSvgAction = exports2.HoverFeedbackAction = exports2.MoveAction = exports2.RedoAction = exports2.UndoAction = exports2.BringToFrontAction = exports2.ViewportResult = exports2.GetViewportAction = exports2.SetViewportAction = exports2.FitToScreenAction = exports2.CenterAction = exports2.LayoutAction = exports2.OpenAction = exports2.CollapseExpandAllAction = exports2.CollapseExpandAction = exports2.SelectionResult = exports2.GetSelectionAction = exports2.SelectAllAction = exports2.SelectAction = exports2.LoggingAction = exports2.ComputedBoundsAction = exports2.RequestBoundsAction = exports2.SetBoundsAction = exports2.SetPopupModelAction = exports2.RequestPopupModelAction = exports2.UpdateModelAction = exports2.SetModelAction = exports2.RequestModelAction = exports2.RejectAction = exports2.isResponseAction = exports2.setRequestContext = exports2.generateRequestId = exports2.isRequestAction = exports2.isAction = exports2.isActionMessage = void 0;
|
|
18897
|
+
var object_1 = require_object();
|
|
18898
|
+
function isActionMessage(object) {
|
|
18899
|
+
return (0, object_1.hasOwnProperty)(object, "action");
|
|
18900
|
+
}
|
|
18901
|
+
exports2.isActionMessage = isActionMessage;
|
|
18902
|
+
function isAction(object) {
|
|
18903
|
+
return (0, object_1.hasOwnProperty)(object, "kind", "string");
|
|
18904
|
+
}
|
|
18905
|
+
exports2.isAction = isAction;
|
|
18906
|
+
function isRequestAction(object) {
|
|
18907
|
+
return (0, object_1.hasOwnProperty)(object, "requestId", "string");
|
|
18908
|
+
}
|
|
18909
|
+
exports2.isRequestAction = isRequestAction;
|
|
18910
|
+
var requestContext = "";
|
|
18911
|
+
var nextRequestId = 1;
|
|
18912
|
+
function generateRequestId() {
|
|
18913
|
+
return `${requestContext}_${nextRequestId++}`;
|
|
18914
|
+
}
|
|
18915
|
+
exports2.generateRequestId = generateRequestId;
|
|
18916
|
+
function setRequestContext(context) {
|
|
18917
|
+
requestContext = context;
|
|
18918
|
+
}
|
|
18919
|
+
exports2.setRequestContext = setRequestContext;
|
|
18920
|
+
function isResponseAction(object) {
|
|
18921
|
+
return (0, object_1.hasOwnProperty)(object, "responseId", "string") && object.responseId !== "";
|
|
18922
|
+
}
|
|
18923
|
+
exports2.isResponseAction = isResponseAction;
|
|
18924
|
+
var RejectAction;
|
|
18925
|
+
(function(RejectAction2) {
|
|
18926
|
+
RejectAction2.KIND = "rejectRequest";
|
|
18927
|
+
function create(options) {
|
|
18928
|
+
return {
|
|
18929
|
+
kind: RejectAction2.KIND,
|
|
18930
|
+
message: options.message,
|
|
18931
|
+
detail: options.detail,
|
|
18932
|
+
responseId: options.requestId
|
|
18933
|
+
};
|
|
18934
|
+
}
|
|
18935
|
+
RejectAction2.create = create;
|
|
18936
|
+
})(RejectAction || (exports2.RejectAction = RejectAction = {}));
|
|
18937
|
+
var RequestModelAction;
|
|
18938
|
+
(function(RequestModelAction2) {
|
|
18939
|
+
RequestModelAction2.KIND = "requestModel";
|
|
18940
|
+
function create(options) {
|
|
18941
|
+
return {
|
|
18942
|
+
kind: RequestModelAction2.KIND,
|
|
18943
|
+
options,
|
|
18944
|
+
requestId: generateRequestId()
|
|
18945
|
+
};
|
|
18946
|
+
}
|
|
18947
|
+
RequestModelAction2.create = create;
|
|
18948
|
+
})(RequestModelAction || (exports2.RequestModelAction = RequestModelAction = {}));
|
|
18949
|
+
var SetModelAction;
|
|
18950
|
+
(function(SetModelAction2) {
|
|
18951
|
+
SetModelAction2.KIND = "setModel";
|
|
18952
|
+
function create(newRoot, requestId = "") {
|
|
18953
|
+
return {
|
|
18954
|
+
kind: SetModelAction2.KIND,
|
|
18955
|
+
newRoot,
|
|
18956
|
+
responseId: requestId
|
|
18957
|
+
};
|
|
18958
|
+
}
|
|
18959
|
+
SetModelAction2.create = create;
|
|
18960
|
+
})(SetModelAction || (exports2.SetModelAction = SetModelAction = {}));
|
|
18961
|
+
var UpdateModelAction;
|
|
18962
|
+
(function(UpdateModelAction2) {
|
|
18963
|
+
UpdateModelAction2.KIND = "updateModel";
|
|
18964
|
+
function create(input, options = {}) {
|
|
18965
|
+
if (Array.isArray(input)) {
|
|
18966
|
+
return {
|
|
18967
|
+
kind: UpdateModelAction2.KIND,
|
|
18968
|
+
matches: input,
|
|
18969
|
+
animate: options.animate,
|
|
18970
|
+
cause: options.cause
|
|
18971
|
+
};
|
|
18972
|
+
} else {
|
|
18973
|
+
return {
|
|
18974
|
+
kind: UpdateModelAction2.KIND,
|
|
18975
|
+
newRoot: input,
|
|
18976
|
+
animate: options.animate,
|
|
18977
|
+
cause: options.cause
|
|
18978
|
+
};
|
|
18979
|
+
}
|
|
18980
|
+
}
|
|
18981
|
+
UpdateModelAction2.create = create;
|
|
18982
|
+
})(UpdateModelAction || (exports2.UpdateModelAction = UpdateModelAction = {}));
|
|
18983
|
+
var RequestPopupModelAction;
|
|
18984
|
+
(function(RequestPopupModelAction2) {
|
|
18985
|
+
RequestPopupModelAction2.KIND = "requestPopupModel";
|
|
18986
|
+
function create(options) {
|
|
18987
|
+
return {
|
|
18988
|
+
kind: RequestPopupModelAction2.KIND,
|
|
18989
|
+
elementId: options.elementId,
|
|
18990
|
+
bounds: options.bounds,
|
|
18991
|
+
requestId: generateRequestId()
|
|
18992
|
+
};
|
|
18993
|
+
}
|
|
18994
|
+
RequestPopupModelAction2.create = create;
|
|
18995
|
+
})(RequestPopupModelAction || (exports2.RequestPopupModelAction = RequestPopupModelAction = {}));
|
|
18996
|
+
var SetPopupModelAction;
|
|
18997
|
+
(function(SetPopupModelAction2) {
|
|
18998
|
+
SetPopupModelAction2.KIND = "setPopupModel";
|
|
18999
|
+
function create(newRoot, requestId = "") {
|
|
19000
|
+
return {
|
|
19001
|
+
kind: SetPopupModelAction2.KIND,
|
|
19002
|
+
newRoot,
|
|
19003
|
+
responseId: requestId
|
|
19004
|
+
};
|
|
19005
|
+
}
|
|
19006
|
+
SetPopupModelAction2.create = create;
|
|
19007
|
+
})(SetPopupModelAction || (exports2.SetPopupModelAction = SetPopupModelAction = {}));
|
|
19008
|
+
var SetBoundsAction;
|
|
19009
|
+
(function(SetBoundsAction2) {
|
|
19010
|
+
SetBoundsAction2.KIND = "setBounds";
|
|
19011
|
+
function create(bounds) {
|
|
19012
|
+
return {
|
|
19013
|
+
kind: SetBoundsAction2.KIND,
|
|
19014
|
+
bounds
|
|
19015
|
+
};
|
|
19016
|
+
}
|
|
19017
|
+
SetBoundsAction2.create = create;
|
|
19018
|
+
})(SetBoundsAction || (exports2.SetBoundsAction = SetBoundsAction = {}));
|
|
19019
|
+
var RequestBoundsAction;
|
|
19020
|
+
(function(RequestBoundsAction2) {
|
|
19021
|
+
RequestBoundsAction2.KIND = "requestBounds";
|
|
19022
|
+
function create(newRoot) {
|
|
19023
|
+
return {
|
|
19024
|
+
kind: RequestBoundsAction2.KIND,
|
|
19025
|
+
newRoot,
|
|
19026
|
+
requestId: generateRequestId()
|
|
19027
|
+
};
|
|
19028
|
+
}
|
|
19029
|
+
RequestBoundsAction2.create = create;
|
|
19030
|
+
})(RequestBoundsAction || (exports2.RequestBoundsAction = RequestBoundsAction = {}));
|
|
19031
|
+
var ComputedBoundsAction;
|
|
19032
|
+
(function(ComputedBoundsAction2) {
|
|
19033
|
+
ComputedBoundsAction2.KIND = "computedBounds";
|
|
19034
|
+
function create(bounds, options = {}) {
|
|
19035
|
+
var _a;
|
|
19036
|
+
return {
|
|
19037
|
+
kind: ComputedBoundsAction2.KIND,
|
|
19038
|
+
bounds,
|
|
19039
|
+
revision: options.revision,
|
|
19040
|
+
alignments: options.alignments,
|
|
19041
|
+
responseId: (_a = options.requestId) !== null && _a !== void 0 ? _a : ""
|
|
19042
|
+
};
|
|
19043
|
+
}
|
|
19044
|
+
ComputedBoundsAction2.create = create;
|
|
19045
|
+
})(ComputedBoundsAction || (exports2.ComputedBoundsAction = ComputedBoundsAction = {}));
|
|
19046
|
+
var LoggingAction;
|
|
19047
|
+
(function(LoggingAction2) {
|
|
19048
|
+
LoggingAction2.KIND = "logging";
|
|
19049
|
+
function create(options) {
|
|
19050
|
+
return Object.assign({ kind: LoggingAction2.KIND }, options);
|
|
19051
|
+
}
|
|
19052
|
+
LoggingAction2.create = create;
|
|
19053
|
+
})(LoggingAction || (exports2.LoggingAction = LoggingAction = {}));
|
|
19054
|
+
var SelectAction;
|
|
19055
|
+
(function(SelectAction2) {
|
|
19056
|
+
SelectAction2.KIND = "elementSelected";
|
|
19057
|
+
function create(options) {
|
|
19058
|
+
var _a, _b;
|
|
19059
|
+
return {
|
|
19060
|
+
kind: SelectAction2.KIND,
|
|
19061
|
+
selectedElementsIDs: (_a = options.selectedElementsIDs) !== null && _a !== void 0 ? _a : [],
|
|
19062
|
+
deselectedElementsIDs: (_b = options.deselectedElementsIDs) !== null && _b !== void 0 ? _b : []
|
|
19063
|
+
};
|
|
19064
|
+
}
|
|
19065
|
+
SelectAction2.create = create;
|
|
19066
|
+
})(SelectAction || (exports2.SelectAction = SelectAction = {}));
|
|
19067
|
+
var SelectAllAction;
|
|
19068
|
+
(function(SelectAllAction2) {
|
|
19069
|
+
SelectAllAction2.KIND = "allSelected";
|
|
19070
|
+
function create(options = {}) {
|
|
19071
|
+
var _a;
|
|
19072
|
+
return {
|
|
19073
|
+
kind: SelectAllAction2.KIND,
|
|
19074
|
+
select: (_a = options.select) !== null && _a !== void 0 ? _a : true
|
|
19075
|
+
};
|
|
19076
|
+
}
|
|
19077
|
+
SelectAllAction2.create = create;
|
|
19078
|
+
})(SelectAllAction || (exports2.SelectAllAction = SelectAllAction = {}));
|
|
19079
|
+
var GetSelectionAction;
|
|
19080
|
+
(function(GetSelectionAction2) {
|
|
19081
|
+
GetSelectionAction2.KIND = "getSelection";
|
|
19082
|
+
function create() {
|
|
19083
|
+
return {
|
|
19084
|
+
kind: GetSelectionAction2.KIND,
|
|
19085
|
+
requestId: generateRequestId()
|
|
19086
|
+
};
|
|
19087
|
+
}
|
|
19088
|
+
GetSelectionAction2.create = create;
|
|
19089
|
+
})(GetSelectionAction || (exports2.GetSelectionAction = GetSelectionAction = {}));
|
|
19090
|
+
var SelectionResult;
|
|
19091
|
+
(function(SelectionResult2) {
|
|
19092
|
+
SelectionResult2.KIND = "selectionResult";
|
|
19093
|
+
function create(selectedElementsIDs, requestId) {
|
|
19094
|
+
return {
|
|
19095
|
+
kind: SelectionResult2.KIND,
|
|
19096
|
+
selectedElementsIDs,
|
|
19097
|
+
responseId: requestId
|
|
19098
|
+
};
|
|
19099
|
+
}
|
|
19100
|
+
SelectionResult2.create = create;
|
|
19101
|
+
})(SelectionResult || (exports2.SelectionResult = SelectionResult = {}));
|
|
19102
|
+
var CollapseExpandAction;
|
|
19103
|
+
(function(CollapseExpandAction2) {
|
|
19104
|
+
CollapseExpandAction2.KIND = "collapseExpand";
|
|
19105
|
+
function create(options) {
|
|
19106
|
+
var _a, _b;
|
|
19107
|
+
return {
|
|
19108
|
+
kind: CollapseExpandAction2.KIND,
|
|
19109
|
+
expandIds: (_a = options.expandIds) !== null && _a !== void 0 ? _a : [],
|
|
19110
|
+
collapseIds: (_b = options.collapseIds) !== null && _b !== void 0 ? _b : []
|
|
19111
|
+
};
|
|
19112
|
+
}
|
|
19113
|
+
CollapseExpandAction2.create = create;
|
|
19114
|
+
})(CollapseExpandAction || (exports2.CollapseExpandAction = CollapseExpandAction = {}));
|
|
19115
|
+
var CollapseExpandAllAction;
|
|
19116
|
+
(function(CollapseExpandAllAction2) {
|
|
19117
|
+
CollapseExpandAllAction2.KIND = "collapseExpandAll";
|
|
19118
|
+
function create(options = {}) {
|
|
19119
|
+
var _a;
|
|
19120
|
+
return {
|
|
19121
|
+
kind: CollapseExpandAllAction2.KIND,
|
|
19122
|
+
expand: (_a = options.expand) !== null && _a !== void 0 ? _a : true
|
|
19123
|
+
};
|
|
19124
|
+
}
|
|
19125
|
+
CollapseExpandAllAction2.create = create;
|
|
19126
|
+
})(CollapseExpandAllAction || (exports2.CollapseExpandAllAction = CollapseExpandAllAction = {}));
|
|
19127
|
+
var OpenAction;
|
|
19128
|
+
(function(OpenAction2) {
|
|
19129
|
+
OpenAction2.KIND = "open";
|
|
19130
|
+
function create(elementId) {
|
|
19131
|
+
return {
|
|
19132
|
+
kind: OpenAction2.KIND,
|
|
19133
|
+
elementId
|
|
19134
|
+
};
|
|
19135
|
+
}
|
|
19136
|
+
OpenAction2.create = create;
|
|
19137
|
+
})(OpenAction || (exports2.OpenAction = OpenAction = {}));
|
|
19138
|
+
var LayoutAction;
|
|
19139
|
+
(function(LayoutAction2) {
|
|
19140
|
+
LayoutAction2.KIND = "layout";
|
|
19141
|
+
function create(options = {}) {
|
|
19142
|
+
return {
|
|
19143
|
+
kind: LayoutAction2.KIND,
|
|
19144
|
+
layoutType: options.layoutType,
|
|
19145
|
+
elementIds: options.elementIds
|
|
19146
|
+
};
|
|
19147
|
+
}
|
|
19148
|
+
LayoutAction2.create = create;
|
|
19149
|
+
})(LayoutAction || (exports2.LayoutAction = LayoutAction = {}));
|
|
19150
|
+
var CenterAction;
|
|
19151
|
+
(function(CenterAction2) {
|
|
19152
|
+
CenterAction2.KIND = "center";
|
|
19153
|
+
function create(elementIds, options = {}) {
|
|
19154
|
+
var _a, _b;
|
|
19155
|
+
return {
|
|
19156
|
+
kind: CenterAction2.KIND,
|
|
19157
|
+
elementIds,
|
|
19158
|
+
animate: (_a = options.animate) !== null && _a !== void 0 ? _a : true,
|
|
19159
|
+
retainZoom: (_b = options.retainZoom) !== null && _b !== void 0 ? _b : false,
|
|
19160
|
+
zoomScale: options.zoomScale
|
|
19161
|
+
};
|
|
19162
|
+
}
|
|
19163
|
+
CenterAction2.create = create;
|
|
19164
|
+
})(CenterAction || (exports2.CenterAction = CenterAction = {}));
|
|
19165
|
+
var FitToScreenAction;
|
|
19166
|
+
(function(FitToScreenAction2) {
|
|
19167
|
+
FitToScreenAction2.KIND = "fit";
|
|
19168
|
+
function create(elementIds, options = {}) {
|
|
19169
|
+
var _a;
|
|
19170
|
+
return {
|
|
19171
|
+
kind: FitToScreenAction2.KIND,
|
|
19172
|
+
elementIds,
|
|
19173
|
+
padding: options.padding,
|
|
19174
|
+
maxZoom: options.maxZoom,
|
|
19175
|
+
animate: (_a = options.animate) !== null && _a !== void 0 ? _a : true
|
|
19176
|
+
};
|
|
19177
|
+
}
|
|
19178
|
+
FitToScreenAction2.create = create;
|
|
19179
|
+
})(FitToScreenAction || (exports2.FitToScreenAction = FitToScreenAction = {}));
|
|
19180
|
+
var SetViewportAction;
|
|
19181
|
+
(function(SetViewportAction2) {
|
|
19182
|
+
SetViewportAction2.KIND = "viewport";
|
|
19183
|
+
function create(elementId, newViewport, options = {}) {
|
|
19184
|
+
var _a;
|
|
19185
|
+
return {
|
|
19186
|
+
kind: SetViewportAction2.KIND,
|
|
19187
|
+
elementId,
|
|
19188
|
+
newViewport,
|
|
19189
|
+
animate: (_a = options.animate) !== null && _a !== void 0 ? _a : true
|
|
19190
|
+
};
|
|
19191
|
+
}
|
|
19192
|
+
SetViewportAction2.create = create;
|
|
19193
|
+
})(SetViewportAction || (exports2.SetViewportAction = SetViewportAction = {}));
|
|
19194
|
+
var GetViewportAction;
|
|
19195
|
+
(function(GetViewportAction2) {
|
|
19196
|
+
GetViewportAction2.KIND = "getViewport";
|
|
19197
|
+
function create() {
|
|
19198
|
+
return {
|
|
19199
|
+
kind: GetViewportAction2.KIND,
|
|
19200
|
+
requestId: generateRequestId()
|
|
19201
|
+
};
|
|
19202
|
+
}
|
|
19203
|
+
GetViewportAction2.create = create;
|
|
19204
|
+
})(GetViewportAction || (exports2.GetViewportAction = GetViewportAction = {}));
|
|
19205
|
+
var ViewportResult;
|
|
19206
|
+
(function(ViewportResult2) {
|
|
19207
|
+
ViewportResult2.KIND = "viewportResult";
|
|
19208
|
+
function create(viewport, canvasBounds, requestId) {
|
|
19209
|
+
return {
|
|
19210
|
+
kind: ViewportResult2.KIND,
|
|
19211
|
+
viewport,
|
|
19212
|
+
canvasBounds,
|
|
19213
|
+
responseId: requestId
|
|
19214
|
+
};
|
|
19215
|
+
}
|
|
19216
|
+
ViewportResult2.create = create;
|
|
19217
|
+
})(ViewportResult || (exports2.ViewportResult = ViewportResult = {}));
|
|
19218
|
+
var BringToFrontAction;
|
|
19219
|
+
(function(BringToFrontAction2) {
|
|
19220
|
+
BringToFrontAction2.KIND = "bringToFront";
|
|
19221
|
+
function create(elementIDs) {
|
|
19222
|
+
return {
|
|
19223
|
+
kind: BringToFrontAction2.KIND,
|
|
19224
|
+
elementIDs
|
|
19225
|
+
};
|
|
19226
|
+
}
|
|
19227
|
+
BringToFrontAction2.create = create;
|
|
19228
|
+
})(BringToFrontAction || (exports2.BringToFrontAction = BringToFrontAction = {}));
|
|
19229
|
+
var UndoAction;
|
|
19230
|
+
(function(UndoAction2) {
|
|
19231
|
+
UndoAction2.KIND = "undo";
|
|
19232
|
+
function create() {
|
|
19233
|
+
return {
|
|
19234
|
+
kind: UndoAction2.KIND
|
|
19235
|
+
};
|
|
19236
|
+
}
|
|
19237
|
+
UndoAction2.create = create;
|
|
19238
|
+
})(UndoAction || (exports2.UndoAction = UndoAction = {}));
|
|
19239
|
+
var RedoAction;
|
|
19240
|
+
(function(RedoAction2) {
|
|
19241
|
+
RedoAction2.KIND = "redo";
|
|
19242
|
+
function create() {
|
|
19243
|
+
return {
|
|
19244
|
+
kind: RedoAction2.KIND
|
|
19245
|
+
};
|
|
19246
|
+
}
|
|
19247
|
+
RedoAction2.create = create;
|
|
19248
|
+
})(RedoAction || (exports2.RedoAction = RedoAction = {}));
|
|
19249
|
+
var MoveAction;
|
|
19250
|
+
(function(MoveAction2) {
|
|
19251
|
+
MoveAction2.KIND = "move";
|
|
19252
|
+
function create(moves, options = {}) {
|
|
19253
|
+
var _a, _b, _c;
|
|
19254
|
+
return {
|
|
19255
|
+
kind: MoveAction2.KIND,
|
|
19256
|
+
moves,
|
|
19257
|
+
animate: (_a = options.animate) !== null && _a !== void 0 ? _a : true,
|
|
19258
|
+
finished: (_b = options.finished) !== null && _b !== void 0 ? _b : false,
|
|
19259
|
+
stoppable: (_c = options.stoppable) !== null && _c !== void 0 ? _c : false
|
|
19260
|
+
};
|
|
19261
|
+
}
|
|
19262
|
+
MoveAction2.create = create;
|
|
19263
|
+
})(MoveAction || (exports2.MoveAction = MoveAction = {}));
|
|
19264
|
+
var HoverFeedbackAction;
|
|
19265
|
+
(function(HoverFeedbackAction2) {
|
|
19266
|
+
HoverFeedbackAction2.KIND = "hoverFeedback";
|
|
19267
|
+
function create(options) {
|
|
19268
|
+
return {
|
|
19269
|
+
kind: HoverFeedbackAction2.KIND,
|
|
19270
|
+
mouseoverElement: options.mouseoverElement,
|
|
19271
|
+
mouseIsOver: options.mouseIsOver
|
|
19272
|
+
};
|
|
19273
|
+
}
|
|
19274
|
+
HoverFeedbackAction2.create = create;
|
|
19275
|
+
})(HoverFeedbackAction || (exports2.HoverFeedbackAction = HoverFeedbackAction = {}));
|
|
19276
|
+
var RequestExportSvgAction;
|
|
19277
|
+
(function(RequestExportSvgAction2) {
|
|
19278
|
+
RequestExportSvgAction2.KIND = "requestExportSvg";
|
|
19279
|
+
function create(options) {
|
|
19280
|
+
return {
|
|
19281
|
+
kind: RequestExportSvgAction2.KIND,
|
|
19282
|
+
requestId: generateRequestId(),
|
|
19283
|
+
options
|
|
19284
|
+
};
|
|
19285
|
+
}
|
|
19286
|
+
RequestExportSvgAction2.create = create;
|
|
19287
|
+
})(RequestExportSvgAction || (exports2.RequestExportSvgAction = RequestExportSvgAction = {}));
|
|
19288
|
+
var ExportSvgAction;
|
|
19289
|
+
(function(ExportSvgAction2) {
|
|
19290
|
+
ExportSvgAction2.KIND = "exportSvg";
|
|
19291
|
+
function create(svg, requestId, options) {
|
|
19292
|
+
return {
|
|
19293
|
+
kind: ExportSvgAction2.KIND,
|
|
19294
|
+
svg,
|
|
19295
|
+
responseId: requestId,
|
|
19296
|
+
options
|
|
19297
|
+
};
|
|
19298
|
+
}
|
|
19299
|
+
ExportSvgAction2.create = create;
|
|
19300
|
+
})(ExportSvgAction || (exports2.ExportSvgAction = ExportSvgAction = {}));
|
|
19301
|
+
var CreateElementAction;
|
|
19302
|
+
(function(CreateElementAction2) {
|
|
19303
|
+
CreateElementAction2.KIND = "createElement";
|
|
19304
|
+
function create(elementSchema, options) {
|
|
19305
|
+
return {
|
|
19306
|
+
kind: CreateElementAction2.KIND,
|
|
19307
|
+
elementSchema,
|
|
19308
|
+
containerId: options.containerId
|
|
19309
|
+
};
|
|
19310
|
+
}
|
|
19311
|
+
CreateElementAction2.create = create;
|
|
19312
|
+
})(CreateElementAction || (exports2.CreateElementAction = CreateElementAction = {}));
|
|
19313
|
+
var DeleteElementAction;
|
|
19314
|
+
(function(DeleteElementAction2) {
|
|
19315
|
+
DeleteElementAction2.KIND = "delete";
|
|
19316
|
+
function create(elementIds) {
|
|
19317
|
+
return {
|
|
19318
|
+
kind: DeleteElementAction2.KIND,
|
|
19319
|
+
elementIds
|
|
19320
|
+
};
|
|
19321
|
+
}
|
|
19322
|
+
DeleteElementAction2.create = create;
|
|
19323
|
+
})(DeleteElementAction || (exports2.DeleteElementAction = DeleteElementAction = {}));
|
|
19324
|
+
var ApplyLabelEditAction;
|
|
19325
|
+
(function(ApplyLabelEditAction2) {
|
|
19326
|
+
ApplyLabelEditAction2.KIND = "applyLabelEdit";
|
|
19327
|
+
function create(labelId, text) {
|
|
19328
|
+
return {
|
|
19329
|
+
kind: ApplyLabelEditAction2.KIND,
|
|
19330
|
+
labelId,
|
|
19331
|
+
text
|
|
19332
|
+
};
|
|
19333
|
+
}
|
|
19334
|
+
ApplyLabelEditAction2.create = create;
|
|
19335
|
+
})(ApplyLabelEditAction || (exports2.ApplyLabelEditAction = ApplyLabelEditAction = {}));
|
|
19336
|
+
var ReconnectAction;
|
|
19337
|
+
(function(ReconnectAction2) {
|
|
19338
|
+
ReconnectAction2.KIND = "reconnect";
|
|
19339
|
+
function create(options) {
|
|
19340
|
+
return {
|
|
19341
|
+
kind: ReconnectAction2.KIND,
|
|
19342
|
+
routableId: options.routableId,
|
|
19343
|
+
newSourceId: options.newSourceId,
|
|
19344
|
+
newTargetId: options.newTargetId
|
|
19345
|
+
};
|
|
19346
|
+
}
|
|
19347
|
+
ReconnectAction2.create = create;
|
|
19348
|
+
})(ReconnectAction || (exports2.ReconnectAction = ReconnectAction = {}));
|
|
19349
|
+
}
|
|
19350
|
+
});
|
|
19351
|
+
|
|
19352
|
+
// node_modules/sprotty-protocol/lib/utils/async.js
|
|
19353
|
+
var require_async2 = __commonJS({
|
|
19354
|
+
"node_modules/sprotty-protocol/lib/utils/async.js"(exports2) {
|
|
19355
|
+
"use strict";
|
|
19356
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19357
|
+
exports2.Deferred = void 0;
|
|
19358
|
+
var Deferred = class {
|
|
19359
|
+
constructor() {
|
|
19360
|
+
this._state = "unresolved";
|
|
19361
|
+
this.promise = new Promise((resolve, reject) => {
|
|
19362
|
+
this.resolve = resolve;
|
|
19363
|
+
this.reject = reject;
|
|
19364
|
+
});
|
|
19365
|
+
this.promise.then((res) => this._state = "resolved", (rej) => this._state = "rejected");
|
|
19366
|
+
}
|
|
19367
|
+
set state(state) {
|
|
19368
|
+
if (this._state === "unresolved") {
|
|
19369
|
+
this._state = state;
|
|
19370
|
+
}
|
|
19371
|
+
}
|
|
19372
|
+
get state() {
|
|
19373
|
+
return this._state;
|
|
19374
|
+
}
|
|
19375
|
+
};
|
|
19376
|
+
exports2.Deferred = Deferred;
|
|
19377
|
+
}
|
|
19378
|
+
});
|
|
19379
|
+
|
|
19380
|
+
// node_modules/sprotty-protocol/lib/utils/model-utils.js
|
|
19381
|
+
var require_model_utils = __commonJS({
|
|
19382
|
+
"node_modules/sprotty-protocol/lib/utils/model-utils.js"(exports2) {
|
|
19383
|
+
"use strict";
|
|
19384
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19385
|
+
exports2.SModelIndex = exports2.findElement = exports2.getSubType = exports2.getBasicType = exports2.applyBounds = exports2.cloneModel = void 0;
|
|
19386
|
+
function cloneModel(model) {
|
|
19387
|
+
return JSON.parse(JSON.stringify(model));
|
|
19388
|
+
}
|
|
19389
|
+
exports2.cloneModel = cloneModel;
|
|
19390
|
+
function applyBounds(root, action) {
|
|
19391
|
+
const index = new SModelIndex();
|
|
19392
|
+
index.add(root);
|
|
19393
|
+
for (const b of action.bounds) {
|
|
19394
|
+
const element = index.getById(b.elementId);
|
|
19395
|
+
if (element) {
|
|
19396
|
+
const bae = element;
|
|
19397
|
+
if (b.newPosition) {
|
|
19398
|
+
bae.position = { x: b.newPosition.x, y: b.newPosition.y };
|
|
19399
|
+
}
|
|
19400
|
+
if (b.newSize) {
|
|
19401
|
+
bae.size = { width: b.newSize.width, height: b.newSize.height };
|
|
19402
|
+
}
|
|
19403
|
+
}
|
|
19404
|
+
}
|
|
19405
|
+
if (action.alignments) {
|
|
19406
|
+
for (const a of action.alignments) {
|
|
19407
|
+
const element = index.getById(a.elementId);
|
|
19408
|
+
if (element) {
|
|
19409
|
+
const alignable = element;
|
|
19410
|
+
alignable.alignment = { x: a.newAlignment.x, y: a.newAlignment.y };
|
|
19411
|
+
}
|
|
19412
|
+
}
|
|
19413
|
+
}
|
|
19414
|
+
}
|
|
19415
|
+
exports2.applyBounds = applyBounds;
|
|
19416
|
+
function getBasicType(element) {
|
|
19417
|
+
if (!element.type) {
|
|
19418
|
+
return "";
|
|
19419
|
+
}
|
|
19420
|
+
const colonIndex = element.type.indexOf(":");
|
|
19421
|
+
return colonIndex >= 0 ? element.type.substring(0, colonIndex) : element.type;
|
|
19422
|
+
}
|
|
19423
|
+
exports2.getBasicType = getBasicType;
|
|
19424
|
+
function getSubType(schema) {
|
|
19425
|
+
if (!schema.type) {
|
|
19426
|
+
return "";
|
|
19427
|
+
}
|
|
19428
|
+
const colonIndex = schema.type.indexOf(":");
|
|
19429
|
+
return colonIndex >= 0 ? schema.type.substring(colonIndex + 1) : schema.type;
|
|
19430
|
+
}
|
|
19431
|
+
exports2.getSubType = getSubType;
|
|
19432
|
+
function findElement(parent, elementId) {
|
|
19433
|
+
if (parent.id === elementId) {
|
|
19434
|
+
return parent;
|
|
19435
|
+
}
|
|
19436
|
+
if (parent.children) {
|
|
19437
|
+
for (const child of parent.children) {
|
|
19438
|
+
const result = findElement(child, elementId);
|
|
19439
|
+
if (result !== void 0) {
|
|
19440
|
+
return result;
|
|
19441
|
+
}
|
|
19442
|
+
}
|
|
19443
|
+
}
|
|
19444
|
+
return void 0;
|
|
19445
|
+
}
|
|
19446
|
+
exports2.findElement = findElement;
|
|
19447
|
+
var SModelIndex = class {
|
|
19448
|
+
constructor() {
|
|
19449
|
+
this.id2element = /* @__PURE__ */ new Map();
|
|
19450
|
+
this.id2parent = /* @__PURE__ */ new Map();
|
|
19451
|
+
}
|
|
19452
|
+
add(element) {
|
|
19453
|
+
if (!element.id) {
|
|
19454
|
+
throw new Error("Model element has no ID.");
|
|
19455
|
+
} else if (this.contains(element)) {
|
|
19456
|
+
throw new Error("Duplicate ID in model: " + element.id);
|
|
19457
|
+
}
|
|
19458
|
+
this.id2element.set(element.id, element);
|
|
19459
|
+
if (Array.isArray(element.children)) {
|
|
19460
|
+
for (const child of element.children) {
|
|
19461
|
+
this.add(child);
|
|
19462
|
+
this.id2parent.set(child.id, element);
|
|
19463
|
+
}
|
|
19464
|
+
}
|
|
19465
|
+
return this;
|
|
19466
|
+
}
|
|
19467
|
+
remove(element) {
|
|
19468
|
+
this.id2element.delete(element.id);
|
|
19469
|
+
if (Array.isArray(element.children)) {
|
|
19470
|
+
for (const child of element.children) {
|
|
19471
|
+
this.id2parent.delete(child.id);
|
|
19472
|
+
this.remove(child);
|
|
19473
|
+
}
|
|
19474
|
+
}
|
|
19475
|
+
return this;
|
|
19476
|
+
}
|
|
19477
|
+
contains(element) {
|
|
19478
|
+
return this.id2element.has(element.id);
|
|
19479
|
+
}
|
|
19480
|
+
getById(id) {
|
|
19481
|
+
return this.id2element.get(id);
|
|
19482
|
+
}
|
|
19483
|
+
getParent(id) {
|
|
19484
|
+
return this.id2parent.get(id);
|
|
19485
|
+
}
|
|
19486
|
+
getRoot(element) {
|
|
19487
|
+
let current = element;
|
|
19488
|
+
while (current) {
|
|
19489
|
+
const parent = this.id2parent.get(current.id);
|
|
19490
|
+
if (parent === void 0) {
|
|
19491
|
+
return current;
|
|
19492
|
+
}
|
|
19493
|
+
current = parent;
|
|
19494
|
+
}
|
|
19495
|
+
throw new Error("Element has no root");
|
|
19496
|
+
}
|
|
19497
|
+
};
|
|
19498
|
+
exports2.SModelIndex = SModelIndex;
|
|
19499
|
+
}
|
|
19500
|
+
});
|
|
19501
|
+
|
|
19502
|
+
// node_modules/sprotty-protocol/lib/diagram-server.js
|
|
19503
|
+
var require_diagram_server = __commonJS({
|
|
19504
|
+
"node_modules/sprotty-protocol/lib/diagram-server.js"(exports2) {
|
|
19505
|
+
"use strict";
|
|
19506
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19507
|
+
exports2.DiagramServer = void 0;
|
|
19508
|
+
var actions_1 = require_actions();
|
|
19509
|
+
var async_1 = require_async2();
|
|
19510
|
+
var model_utils_1 = require_model_utils();
|
|
19511
|
+
var DiagramServer = class {
|
|
19512
|
+
constructor(dispatch, services) {
|
|
19513
|
+
this.state = {
|
|
19514
|
+
currentRoot: {
|
|
19515
|
+
type: "NONE",
|
|
19516
|
+
id: "ROOT"
|
|
19517
|
+
},
|
|
19518
|
+
revision: 0
|
|
19519
|
+
};
|
|
19520
|
+
this.requests = /* @__PURE__ */ new Map();
|
|
19521
|
+
this.dispatch = dispatch;
|
|
19522
|
+
this.diagramGenerator = services.DiagramGenerator;
|
|
19523
|
+
this.layoutEngine = services.ModelLayoutEngine;
|
|
19524
|
+
this.actionHandlerRegistry = services.ServerActionHandlerRegistry;
|
|
19525
|
+
}
|
|
19526
|
+
/**
|
|
19527
|
+
* Set the model and submit it to the client.
|
|
19528
|
+
*/
|
|
19529
|
+
setModel(newRoot) {
|
|
19530
|
+
newRoot.revision = ++this.state.revision;
|
|
19531
|
+
this.state.currentRoot = newRoot;
|
|
19532
|
+
return this.submitModel(newRoot, false);
|
|
19533
|
+
}
|
|
19534
|
+
/**
|
|
19535
|
+
* Update the model to a new state and submit it to the client.
|
|
19536
|
+
*/
|
|
19537
|
+
updateModel(newRoot) {
|
|
19538
|
+
newRoot.revision = ++this.state.revision;
|
|
19539
|
+
this.state.currentRoot = newRoot;
|
|
19540
|
+
return this.submitModel(newRoot, true);
|
|
19541
|
+
}
|
|
19542
|
+
/**
|
|
19543
|
+
* Whether the client needs to compute the layout of parts of the model. This affects the behavior
|
|
19544
|
+
* of `submitModel`.
|
|
19545
|
+
*
|
|
19546
|
+
* This setting is determined by the `DiagramOptions` that are received with the `RequestModelAction`
|
|
19547
|
+
* from the client. If the client does not specify whether it needs client layout, the default value
|
|
19548
|
+
* is `true`.
|
|
19549
|
+
*/
|
|
19550
|
+
get needsClientLayout() {
|
|
19551
|
+
if (this.state.options && this.state.options.needsClientLayout !== void 0) {
|
|
19552
|
+
return !!this.state.options.needsClientLayout;
|
|
19553
|
+
}
|
|
19554
|
+
return true;
|
|
19555
|
+
}
|
|
19556
|
+
/**
|
|
19557
|
+
* Whether the server needs to compute the layout of parts of the model. This affects the behavior
|
|
19558
|
+
* of `submitModel`.
|
|
19559
|
+
*
|
|
19560
|
+
* This setting is determined by the `DiagramOptions` that are received with the `RequestModelAction`
|
|
19561
|
+
* from the client. If the client does not specify whether it needs server layout, the default value
|
|
19562
|
+
* is `false`.
|
|
19563
|
+
*/
|
|
19564
|
+
get needsServerLayout() {
|
|
19565
|
+
if (this.state.options && this.state.options.needsServerLayout !== void 0) {
|
|
19566
|
+
return !!this.state.options.needsServerLayout;
|
|
19567
|
+
}
|
|
19568
|
+
return false;
|
|
19569
|
+
}
|
|
19570
|
+
/**
|
|
19571
|
+
* Called when an action is received from the client.
|
|
19572
|
+
*/
|
|
19573
|
+
accept(action) {
|
|
19574
|
+
if ((0, actions_1.isResponseAction)(action)) {
|
|
19575
|
+
const id = action.responseId;
|
|
19576
|
+
const future = this.requests.get(id);
|
|
19577
|
+
if (future) {
|
|
19578
|
+
this.requests.delete(id);
|
|
19579
|
+
if (action.kind === actions_1.RejectAction.KIND) {
|
|
19580
|
+
const rejectAction = action;
|
|
19581
|
+
future.reject(new Error(rejectAction.message));
|
|
19582
|
+
console.warn(`Request with id ${action.responseId} failed: ${rejectAction.message}`, rejectAction.detail);
|
|
19583
|
+
} else {
|
|
19584
|
+
future.resolve(action);
|
|
19585
|
+
}
|
|
19586
|
+
return Promise.resolve();
|
|
19587
|
+
}
|
|
19588
|
+
console.info("No matching request for response:", action);
|
|
19589
|
+
}
|
|
19590
|
+
return this.handleAction(action);
|
|
19591
|
+
}
|
|
19592
|
+
/**
|
|
19593
|
+
* Send a request action to the client. The resulting promise is resolved when a matching
|
|
19594
|
+
* response is received and rejected when a `RejectAction` is received.
|
|
19595
|
+
*/
|
|
19596
|
+
request(action) {
|
|
19597
|
+
if (!action.requestId) {
|
|
19598
|
+
action.requestId = "server_" + (0, actions_1.generateRequestId)();
|
|
19599
|
+
}
|
|
19600
|
+
const future = new async_1.Deferred();
|
|
19601
|
+
this.requests.set(action.requestId, future);
|
|
19602
|
+
this.dispatch(action).catch((err) => {
|
|
19603
|
+
this.requests.delete(action.requestId);
|
|
19604
|
+
future.reject(err);
|
|
19605
|
+
});
|
|
19606
|
+
return future.promise;
|
|
19607
|
+
}
|
|
19608
|
+
/**
|
|
19609
|
+
* Send a `RejectAction` to the client to notify that a request could not be fulfilled.
|
|
19610
|
+
*/
|
|
19611
|
+
rejectRemoteRequest(action, error) {
|
|
19612
|
+
if (action && (0, actions_1.isRequestAction)(action)) {
|
|
19613
|
+
this.dispatch({
|
|
19614
|
+
kind: actions_1.RejectAction.KIND,
|
|
19615
|
+
responseId: action.requestId,
|
|
19616
|
+
message: error.message,
|
|
19617
|
+
detail: error.stack
|
|
19618
|
+
});
|
|
19619
|
+
}
|
|
19620
|
+
}
|
|
19621
|
+
handleAction(action) {
|
|
19622
|
+
var _a, _b;
|
|
19623
|
+
const handlers = (_a = this.actionHandlerRegistry) === null || _a === void 0 ? void 0 : _a.getHandler(action.kind);
|
|
19624
|
+
if (handlers && handlers.length === 1) {
|
|
19625
|
+
return (_b = handlers[0](action, this.state, this)) !== null && _b !== void 0 ? _b : Promise.resolve();
|
|
19626
|
+
} else if (handlers && handlers.length > 1) {
|
|
19627
|
+
return Promise.all(handlers.map((h) => {
|
|
19628
|
+
var _a2;
|
|
19629
|
+
return (_a2 = h(action, this.state, this)) !== null && _a2 !== void 0 ? _a2 : Promise.resolve();
|
|
19630
|
+
}));
|
|
19631
|
+
}
|
|
19632
|
+
switch (action.kind) {
|
|
19633
|
+
case actions_1.RequestModelAction.KIND:
|
|
19634
|
+
return this.handleRequestModel(action);
|
|
19635
|
+
case actions_1.ComputedBoundsAction.KIND:
|
|
19636
|
+
return this.handleComputedBounds(action);
|
|
19637
|
+
case actions_1.LayoutAction.KIND:
|
|
19638
|
+
return this.handleLayout(action);
|
|
19639
|
+
}
|
|
19640
|
+
console.warn(`Unhandled action from client: ${action.kind}`);
|
|
19641
|
+
return Promise.resolve();
|
|
19642
|
+
}
|
|
19643
|
+
async handleRequestModel(action) {
|
|
19644
|
+
var _a;
|
|
19645
|
+
this.state.options = action.options;
|
|
19646
|
+
try {
|
|
19647
|
+
const newRoot = await this.diagramGenerator.generate({
|
|
19648
|
+
options: (_a = this.state.options) !== null && _a !== void 0 ? _a : {},
|
|
19649
|
+
state: this.state
|
|
19650
|
+
});
|
|
19651
|
+
newRoot.revision = ++this.state.revision;
|
|
19652
|
+
this.state.currentRoot = newRoot;
|
|
19653
|
+
await this.submitModel(this.state.currentRoot, false, action);
|
|
19654
|
+
} catch (err) {
|
|
19655
|
+
this.rejectRemoteRequest(action, err);
|
|
19656
|
+
console.error("Failed to generate diagram:", err);
|
|
19657
|
+
}
|
|
19658
|
+
}
|
|
19659
|
+
/**
|
|
19660
|
+
* Submit a model to the client after it has been updated in the server state.
|
|
19661
|
+
*/
|
|
19662
|
+
async submitModel(newRoot, update, cause) {
|
|
19663
|
+
if (this.needsClientLayout) {
|
|
19664
|
+
if (!this.needsServerLayout) {
|
|
19665
|
+
this.dispatch({ kind: actions_1.RequestBoundsAction.KIND, newRoot });
|
|
19666
|
+
} else {
|
|
19667
|
+
const request = actions_1.RequestBoundsAction.create(newRoot);
|
|
19668
|
+
const response = await this.request(request);
|
|
19669
|
+
const currentRoot = this.state.currentRoot;
|
|
19670
|
+
if (response.revision === currentRoot.revision) {
|
|
19671
|
+
(0, model_utils_1.applyBounds)(currentRoot, response);
|
|
19672
|
+
await this.doSubmitModel(currentRoot, update, cause);
|
|
19673
|
+
} else {
|
|
19674
|
+
this.rejectRemoteRequest(cause, new Error(`Model revision does not match: ${response.revision}`));
|
|
19675
|
+
}
|
|
19676
|
+
}
|
|
19677
|
+
} else {
|
|
19678
|
+
await this.doSubmitModel(newRoot, update, cause);
|
|
19679
|
+
}
|
|
19680
|
+
}
|
|
19681
|
+
async doSubmitModel(newRoot, update, cause) {
|
|
19682
|
+
if (newRoot.revision !== this.state.revision) {
|
|
19683
|
+
return;
|
|
19684
|
+
}
|
|
19685
|
+
if (this.needsServerLayout && this.layoutEngine) {
|
|
19686
|
+
newRoot = await this.layoutEngine.layout(newRoot);
|
|
19687
|
+
}
|
|
19688
|
+
const modelType = newRoot.type;
|
|
19689
|
+
if (cause && cause.kind === actions_1.RequestModelAction.KIND) {
|
|
19690
|
+
const requestId = cause.requestId;
|
|
19691
|
+
const response = actions_1.SetModelAction.create(newRoot, requestId);
|
|
19692
|
+
await this.dispatch(response);
|
|
19693
|
+
} else if (update && modelType === this.state.lastSubmittedModelType) {
|
|
19694
|
+
await this.dispatch({ kind: actions_1.UpdateModelAction.KIND, newRoot, cause });
|
|
19695
|
+
} else {
|
|
19696
|
+
await this.dispatch({ kind: actions_1.SetModelAction.KIND, newRoot });
|
|
19697
|
+
}
|
|
19698
|
+
this.state.lastSubmittedModelType = modelType;
|
|
19699
|
+
}
|
|
19700
|
+
handleComputedBounds(action) {
|
|
19701
|
+
if (action.revision !== this.state.currentRoot.revision) {
|
|
19702
|
+
return Promise.reject();
|
|
19703
|
+
}
|
|
19704
|
+
(0, model_utils_1.applyBounds)(this.state.currentRoot, action);
|
|
19705
|
+
return Promise.resolve();
|
|
19706
|
+
}
|
|
19707
|
+
async handleLayout(action) {
|
|
19708
|
+
if (!this.layoutEngine) {
|
|
19709
|
+
return;
|
|
19710
|
+
}
|
|
19711
|
+
if (!this.needsServerLayout) {
|
|
19712
|
+
let newRoot = (0, model_utils_1.cloneModel)(this.state.currentRoot);
|
|
19713
|
+
newRoot = await this.layoutEngine.layout(newRoot);
|
|
19714
|
+
newRoot.revision = ++this.state.revision;
|
|
19715
|
+
this.state.currentRoot = newRoot;
|
|
19716
|
+
}
|
|
19717
|
+
await this.doSubmitModel(this.state.currentRoot, true, action);
|
|
19718
|
+
}
|
|
19719
|
+
};
|
|
19720
|
+
exports2.DiagramServer = DiagramServer;
|
|
19721
|
+
}
|
|
19722
|
+
});
|
|
19723
|
+
|
|
19724
|
+
// node_modules/sprotty-protocol/lib/diagram-services.js
|
|
19725
|
+
var require_diagram_services = __commonJS({
|
|
19726
|
+
"node_modules/sprotty-protocol/lib/diagram-services.js"(exports2) {
|
|
19727
|
+
"use strict";
|
|
19728
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19729
|
+
}
|
|
19730
|
+
});
|
|
19731
|
+
|
|
19732
|
+
// node_modules/sprotty-protocol/lib/model.js
|
|
19733
|
+
var require_model = __commonJS({
|
|
19734
|
+
"node_modules/sprotty-protocol/lib/model.js"(exports2) {
|
|
19735
|
+
"use strict";
|
|
19736
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19737
|
+
exports2.isZoomable = exports2.isScrollable = void 0;
|
|
19738
|
+
var object_1 = require_object();
|
|
19739
|
+
function isScrollable(element) {
|
|
19740
|
+
return (0, object_1.hasOwnProperty)(element, "scroll");
|
|
19741
|
+
}
|
|
19742
|
+
exports2.isScrollable = isScrollable;
|
|
19743
|
+
function isZoomable(element) {
|
|
19744
|
+
return (0, object_1.hasOwnProperty)(element, "zoom");
|
|
19745
|
+
}
|
|
19746
|
+
exports2.isZoomable = isZoomable;
|
|
19747
|
+
}
|
|
19748
|
+
});
|
|
19749
|
+
|
|
19750
|
+
// node_modules/sprotty-protocol/lib/utils/geometry.js
|
|
19751
|
+
var require_geometry = __commonJS({
|
|
19752
|
+
"node_modules/sprotty-protocol/lib/utils/geometry.js"(exports2) {
|
|
19753
|
+
"use strict";
|
|
19754
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19755
|
+
exports2.almostEquals = exports2.toRadians = exports2.toDegrees = exports2.Bounds = exports2.isBounds = exports2.Dimension = exports2.centerOfLine = exports2.angleBetweenPoints = exports2.angleOfPoint = exports2.Point = void 0;
|
|
19756
|
+
var object_1 = require_object();
|
|
19757
|
+
var Point;
|
|
19758
|
+
(function(Point2) {
|
|
19759
|
+
Point2.ORIGIN = Object.freeze({
|
|
19760
|
+
x: 0,
|
|
19761
|
+
y: 0
|
|
19762
|
+
});
|
|
19763
|
+
function add(p1, p2) {
|
|
19764
|
+
return {
|
|
19765
|
+
x: p1.x + p2.x,
|
|
19766
|
+
y: p1.y + p2.y
|
|
19767
|
+
};
|
|
19768
|
+
}
|
|
19769
|
+
Point2.add = add;
|
|
19770
|
+
function subtract(p1, p2) {
|
|
19771
|
+
return {
|
|
19772
|
+
x: p1.x - p2.x,
|
|
19773
|
+
y: p1.y - p2.y
|
|
19774
|
+
};
|
|
19775
|
+
}
|
|
19776
|
+
Point2.subtract = subtract;
|
|
19777
|
+
function equals(point1, point2) {
|
|
19778
|
+
return point1.x === point2.x && point1.y === point2.y;
|
|
19779
|
+
}
|
|
19780
|
+
Point2.equals = equals;
|
|
19781
|
+
function shiftTowards(point, refPoint, distance) {
|
|
19782
|
+
const diff = subtract(refPoint, point);
|
|
19783
|
+
const normalized = normalize(diff);
|
|
19784
|
+
const shift = { x: normalized.x * distance, y: normalized.y * distance };
|
|
19785
|
+
return add(point, shift);
|
|
19786
|
+
}
|
|
19787
|
+
Point2.shiftTowards = shiftTowards;
|
|
19788
|
+
function normalize(point) {
|
|
19789
|
+
const mag = magnitude(point);
|
|
19790
|
+
if (mag === 0 || mag === 1) {
|
|
19791
|
+
return Point2.ORIGIN;
|
|
19792
|
+
}
|
|
19793
|
+
return {
|
|
19794
|
+
x: point.x / mag,
|
|
19795
|
+
y: point.y / mag
|
|
19796
|
+
};
|
|
19797
|
+
}
|
|
19798
|
+
Point2.normalize = normalize;
|
|
19799
|
+
function magnitude(point) {
|
|
19800
|
+
return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
|
|
19801
|
+
}
|
|
19802
|
+
Point2.magnitude = magnitude;
|
|
19803
|
+
function linear(p0, p1, lambda) {
|
|
19804
|
+
return {
|
|
19805
|
+
x: (1 - lambda) * p0.x + lambda * p1.x,
|
|
19806
|
+
y: (1 - lambda) * p0.y + lambda * p1.y
|
|
19807
|
+
};
|
|
19808
|
+
}
|
|
19809
|
+
Point2.linear = linear;
|
|
19810
|
+
function euclideanDistance(a, b) {
|
|
19811
|
+
const dx = b.x - a.x;
|
|
19812
|
+
const dy = b.y - a.y;
|
|
19813
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
19814
|
+
}
|
|
19815
|
+
Point2.euclideanDistance = euclideanDistance;
|
|
19816
|
+
function manhattanDistance(a, b) {
|
|
19817
|
+
return Math.abs(b.x - a.x) + Math.abs(b.y - a.y);
|
|
19818
|
+
}
|
|
19819
|
+
Point2.manhattanDistance = manhattanDistance;
|
|
19820
|
+
function maxDistance(a, b) {
|
|
19821
|
+
return Math.max(Math.abs(b.x - a.x), Math.abs(b.y - a.y));
|
|
19822
|
+
}
|
|
19823
|
+
Point2.maxDistance = maxDistance;
|
|
19824
|
+
function dotProduct(a, b) {
|
|
19825
|
+
return a.x * b.x + a.y * b.y;
|
|
19826
|
+
}
|
|
19827
|
+
Point2.dotProduct = dotProduct;
|
|
19828
|
+
})(Point || (exports2.Point = Point = {}));
|
|
19829
|
+
function angleOfPoint(p) {
|
|
19830
|
+
return Math.atan2(p.y, p.x);
|
|
19831
|
+
}
|
|
19832
|
+
exports2.angleOfPoint = angleOfPoint;
|
|
19833
|
+
function angleBetweenPoints(a, b) {
|
|
19834
|
+
const lengthProduct = Math.sqrt((a.x * a.x + a.y * a.y) * (b.x * b.x + b.y * b.y));
|
|
19835
|
+
if (isNaN(lengthProduct) || lengthProduct === 0)
|
|
19836
|
+
return NaN;
|
|
19837
|
+
const dotProduct = a.x * b.x + a.y * b.y;
|
|
19838
|
+
return Math.acos(dotProduct / lengthProduct);
|
|
19839
|
+
}
|
|
19840
|
+
exports2.angleBetweenPoints = angleBetweenPoints;
|
|
19841
|
+
function centerOfLine(s, e) {
|
|
19842
|
+
const b = {
|
|
19843
|
+
x: s.x > e.x ? e.x : s.x,
|
|
19844
|
+
y: s.y > e.y ? e.y : s.y,
|
|
19845
|
+
width: Math.abs(e.x - s.x),
|
|
19846
|
+
height: Math.abs(e.y - s.y)
|
|
19847
|
+
};
|
|
19848
|
+
return Bounds.center(b);
|
|
19849
|
+
}
|
|
19850
|
+
exports2.centerOfLine = centerOfLine;
|
|
19851
|
+
var Dimension;
|
|
19852
|
+
(function(Dimension2) {
|
|
19853
|
+
Dimension2.EMPTY = Object.freeze({
|
|
19854
|
+
width: -1,
|
|
19855
|
+
height: -1
|
|
19856
|
+
});
|
|
19857
|
+
function isValid(d) {
|
|
19858
|
+
return d.width >= 0 && d.height >= 0;
|
|
19859
|
+
}
|
|
19860
|
+
Dimension2.isValid = isValid;
|
|
19861
|
+
})(Dimension || (exports2.Dimension = Dimension = {}));
|
|
19862
|
+
function isBounds(element) {
|
|
19863
|
+
return (0, object_1.hasOwnProperty)(element, ["x", "y", "width", "height"]);
|
|
19864
|
+
}
|
|
19865
|
+
exports2.isBounds = isBounds;
|
|
19866
|
+
var Bounds;
|
|
19867
|
+
(function(Bounds2) {
|
|
19868
|
+
Bounds2.EMPTY = Object.freeze({
|
|
19869
|
+
x: 0,
|
|
19870
|
+
y: 0,
|
|
19871
|
+
width: -1,
|
|
19872
|
+
height: -1
|
|
19873
|
+
});
|
|
19874
|
+
function combine(b0, b1) {
|
|
19875
|
+
if (!Dimension.isValid(b0))
|
|
19876
|
+
return Dimension.isValid(b1) ? b1 : Bounds2.EMPTY;
|
|
19877
|
+
if (!Dimension.isValid(b1))
|
|
19878
|
+
return b0;
|
|
19879
|
+
const minX = Math.min(b0.x, b1.x);
|
|
19880
|
+
const minY = Math.min(b0.y, b1.y);
|
|
19881
|
+
const maxX = Math.max(b0.x + (b0.width >= 0 ? b0.width : 0), b1.x + (b1.width >= 0 ? b1.width : 0));
|
|
19882
|
+
const maxY = Math.max(b0.y + (b0.height >= 0 ? b0.height : 0), b1.y + (b1.height >= 0 ? b1.height : 0));
|
|
19883
|
+
return {
|
|
19884
|
+
x: minX,
|
|
19885
|
+
y: minY,
|
|
19886
|
+
width: maxX - minX,
|
|
19887
|
+
height: maxY - minY
|
|
19888
|
+
};
|
|
19889
|
+
}
|
|
19890
|
+
Bounds2.combine = combine;
|
|
19891
|
+
function translate(b, p) {
|
|
19892
|
+
return {
|
|
19893
|
+
x: b.x + p.x,
|
|
19894
|
+
y: b.y + p.y,
|
|
19895
|
+
width: b.width,
|
|
19896
|
+
height: b.height
|
|
19897
|
+
};
|
|
19898
|
+
}
|
|
19899
|
+
Bounds2.translate = translate;
|
|
19900
|
+
function center(b) {
|
|
19901
|
+
return {
|
|
19902
|
+
x: b.x + (b.width >= 0 ? 0.5 * b.width : 0),
|
|
19903
|
+
y: b.y + (b.height >= 0 ? 0.5 * b.height : 0)
|
|
19904
|
+
};
|
|
19905
|
+
}
|
|
19906
|
+
Bounds2.center = center;
|
|
19907
|
+
function includes(b, p) {
|
|
19908
|
+
return p.x >= b.x && p.x <= b.x + b.width && p.y >= b.y && p.y <= b.y + b.height;
|
|
19909
|
+
}
|
|
19910
|
+
Bounds2.includes = includes;
|
|
19911
|
+
})(Bounds || (exports2.Bounds = Bounds = {}));
|
|
19912
|
+
function toDegrees(a) {
|
|
19913
|
+
return a * 180 / Math.PI;
|
|
19914
|
+
}
|
|
19915
|
+
exports2.toDegrees = toDegrees;
|
|
19916
|
+
function toRadians(a) {
|
|
19917
|
+
return a * Math.PI / 180;
|
|
19918
|
+
}
|
|
19919
|
+
exports2.toRadians = toRadians;
|
|
19920
|
+
function almostEquals(a, b) {
|
|
19921
|
+
return Math.abs(a - b) < 1e-3;
|
|
19922
|
+
}
|
|
19923
|
+
exports2.almostEquals = almostEquals;
|
|
19924
|
+
}
|
|
19925
|
+
});
|
|
19926
|
+
|
|
19927
|
+
// node_modules/sprotty-protocol/lib/utils/json.js
|
|
19928
|
+
var require_json = __commonJS({
|
|
19929
|
+
"node_modules/sprotty-protocol/lib/utils/json.js"(exports2) {
|
|
19930
|
+
"use strict";
|
|
19931
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19932
|
+
}
|
|
19933
|
+
});
|
|
19934
|
+
|
|
19935
|
+
// node_modules/sprotty-protocol/lib/index.js
|
|
19936
|
+
var require_lib3 = __commonJS({
|
|
19937
|
+
"node_modules/sprotty-protocol/lib/index.js"(exports2) {
|
|
19938
|
+
"use strict";
|
|
19939
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
19940
|
+
if (k2 === void 0)
|
|
19941
|
+
k2 = k;
|
|
19942
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19943
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19944
|
+
desc = { enumerable: true, get: function() {
|
|
19945
|
+
return m[k];
|
|
19946
|
+
} };
|
|
19947
|
+
}
|
|
19948
|
+
Object.defineProperty(o, k2, desc);
|
|
19949
|
+
} : function(o, m, k, k2) {
|
|
19950
|
+
if (k2 === void 0)
|
|
19951
|
+
k2 = k;
|
|
19952
|
+
o[k2] = m[k];
|
|
19953
|
+
});
|
|
19954
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
19955
|
+
for (var p in m)
|
|
19956
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
19957
|
+
__createBinding(exports3, m, p);
|
|
19958
|
+
};
|
|
19959
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19960
|
+
__exportStar(require_action_handler(), exports2);
|
|
19961
|
+
__exportStar(require_actions(), exports2);
|
|
19962
|
+
__exportStar(require_diagram_server(), exports2);
|
|
19963
|
+
__exportStar(require_diagram_services(), exports2);
|
|
19964
|
+
__exportStar(require_model(), exports2);
|
|
19965
|
+
__exportStar(require_async2(), exports2);
|
|
19966
|
+
__exportStar(require_geometry(), exports2);
|
|
19967
|
+
__exportStar(require_json(), exports2);
|
|
19968
|
+
__exportStar(require_model_utils(), exports2);
|
|
19969
|
+
__exportStar(require_object(), exports2);
|
|
19970
|
+
}
|
|
19971
|
+
});
|
|
19972
|
+
|
|
19973
|
+
// node_modules/sprotty-vscode-protocol/lib/handshake.js
|
|
19974
|
+
var require_handshake = __commonJS({
|
|
19975
|
+
"node_modules/sprotty-vscode-protocol/lib/handshake.js"(exports2) {
|
|
19976
|
+
"use strict";
|
|
19977
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19978
|
+
exports2.ActionNotification = exports2.DiagramIdentifierNotification = exports2.SprottyDiagramIdentifier = exports2.WebviewReadyNotification = void 0;
|
|
19979
|
+
exports2.WebviewReadyNotification = { method: "WebviewReadyMessage" };
|
|
19980
|
+
exports2.SprottyDiagramIdentifier = Symbol("SprottyDiagramIdentifier");
|
|
19981
|
+
exports2.DiagramIdentifierNotification = { method: "SprottyDiagramIdentifier" };
|
|
19982
|
+
exports2.ActionNotification = { method: "ActionMessage" };
|
|
19983
|
+
}
|
|
19984
|
+
});
|
|
19985
|
+
|
|
19986
|
+
// node_modules/sprotty-vscode-protocol/lib/index.js
|
|
19987
|
+
var require_lib4 = __commonJS({
|
|
19988
|
+
"node_modules/sprotty-vscode-protocol/lib/index.js"(exports2) {
|
|
19989
|
+
"use strict";
|
|
19990
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
19991
|
+
if (k2 === void 0)
|
|
19992
|
+
k2 = k;
|
|
19993
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19994
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19995
|
+
desc = { enumerable: true, get: function() {
|
|
19996
|
+
return m[k];
|
|
19997
|
+
} };
|
|
19998
|
+
}
|
|
19999
|
+
Object.defineProperty(o, k2, desc);
|
|
20000
|
+
} : function(o, m, k, k2) {
|
|
20001
|
+
if (k2 === void 0)
|
|
20002
|
+
k2 = k;
|
|
20003
|
+
o[k2] = m[k];
|
|
20004
|
+
});
|
|
20005
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
20006
|
+
for (var p in m)
|
|
20007
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
20008
|
+
__createBinding(exports3, m, p);
|
|
20009
|
+
};
|
|
20010
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20011
|
+
__exportStar(require_handshake(), exports2);
|
|
20012
|
+
}
|
|
20013
|
+
});
|
|
20014
|
+
|
|
20015
|
+
// node_modules/sprotty-vscode/lib/webview-endpoint.js
|
|
20016
|
+
var require_webview_endpoint = __commonJS({
|
|
20017
|
+
"node_modules/sprotty-vscode/lib/webview-endpoint.js"(exports2) {
|
|
20018
|
+
"use strict";
|
|
20019
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20020
|
+
exports2.WebviewEndpoint = exports2.isWebviewView = exports2.isWebviewPanel = void 0;
|
|
20021
|
+
var sprotty_protocol_1 = require_lib3();
|
|
20022
|
+
var sprotty_vscode_protocol_1 = require_lib4();
|
|
20023
|
+
var vscode2 = require("vscode");
|
|
20024
|
+
function isWebviewPanel(container) {
|
|
20025
|
+
return typeof container.onDidChangeViewState === "function";
|
|
20026
|
+
}
|
|
20027
|
+
exports2.isWebviewPanel = isWebviewPanel;
|
|
20028
|
+
function isWebviewView(container) {
|
|
20029
|
+
return typeof container.onDidChangeVisibility === "function";
|
|
20030
|
+
}
|
|
20031
|
+
exports2.isWebviewView = isWebviewView;
|
|
20032
|
+
var WebviewEndpoint = class {
|
|
20033
|
+
constructor(options) {
|
|
20034
|
+
this.actionHandlers = /* @__PURE__ */ new Map();
|
|
20035
|
+
this.disposables = [];
|
|
20036
|
+
this.webviewReady = new Promise((resolve) => this.resolveWebviewReady = resolve);
|
|
20037
|
+
this.webviewContainer = options.webviewContainer;
|
|
20038
|
+
this.messenger = options.messenger;
|
|
20039
|
+
this.messageParticipant = options.messageParticipant;
|
|
20040
|
+
this.diagramIdentifier = options.identifier;
|
|
20041
|
+
if (options.diagramServer) {
|
|
20042
|
+
this.diagramServer = options.diagramServer;
|
|
20043
|
+
} else if (options.diagramServerFactory) {
|
|
20044
|
+
const dispatch = (action) => this.sendAction(action);
|
|
20045
|
+
this.diagramServer = options.diagramServerFactory(dispatch);
|
|
20046
|
+
}
|
|
20047
|
+
this.connect();
|
|
20048
|
+
}
|
|
20049
|
+
get ready() {
|
|
20050
|
+
return this.webviewReady;
|
|
20051
|
+
}
|
|
20052
|
+
connect() {
|
|
20053
|
+
this.disposables.push(this.webviewContainer.onDidDispose(() => {
|
|
20054
|
+
this.disposables.forEach((disposable) => disposable.dispose());
|
|
20055
|
+
}));
|
|
20056
|
+
if (isWebviewPanel(this.webviewContainer)) {
|
|
20057
|
+
this.disposables.push(this.webviewContainer.onDidChangeViewState((event) => {
|
|
20058
|
+
this.setWebviewActiveContext(event.webviewPanel.active);
|
|
20059
|
+
}));
|
|
20060
|
+
}
|
|
20061
|
+
this.disposables.push(this.messenger.onNotification(sprotty_vscode_protocol_1.ActionNotification, (message) => this.receiveAction(message), { sender: this.messageParticipant }));
|
|
20062
|
+
this.disposables.push(this.messenger.onNotification(sprotty_vscode_protocol_1.WebviewReadyNotification, (message) => {
|
|
20063
|
+
this.resolveWebviewReady();
|
|
20064
|
+
this.sendDiagramIdentifier();
|
|
20065
|
+
}, { sender: this.messageParticipant }));
|
|
20066
|
+
}
|
|
20067
|
+
/**
|
|
20068
|
+
* Enable or disable a context variable to be used in UI contributions in the package.json file.
|
|
20069
|
+
*/
|
|
20070
|
+
setWebviewActiveContext(isActive) {
|
|
20071
|
+
if (this.diagramIdentifier) {
|
|
20072
|
+
vscode2.commands.executeCommand("setContext", this.diagramIdentifier.diagramType + "-focused", isActive);
|
|
20073
|
+
}
|
|
20074
|
+
}
|
|
20075
|
+
/**
|
|
20076
|
+
* Trigger loading of new content in the webview. The content is identified by the URI and diagram type.
|
|
20077
|
+
*/
|
|
20078
|
+
async reloadContent(newIdentifier) {
|
|
20079
|
+
if (this.diagramIdentifier) {
|
|
20080
|
+
this.diagramIdentifier.uri = newIdentifier.uri;
|
|
20081
|
+
this.diagramIdentifier.diagramType = newIdentifier.diagramType;
|
|
20082
|
+
} else {
|
|
20083
|
+
this.diagramIdentifier = newIdentifier;
|
|
20084
|
+
}
|
|
20085
|
+
await this.sendDiagramIdentifier();
|
|
20086
|
+
}
|
|
20087
|
+
async sendDiagramIdentifier() {
|
|
20088
|
+
await this.ready;
|
|
20089
|
+
if (this.diagramIdentifier) {
|
|
20090
|
+
this.messenger.sendNotification(sprotty_vscode_protocol_1.DiagramIdentifierNotification, this.messageParticipant, this.diagramIdentifier);
|
|
20091
|
+
}
|
|
20092
|
+
}
|
|
20093
|
+
/**
|
|
20094
|
+
* Send an action to the webview to be processed by the Sprotty frontend.
|
|
20095
|
+
*/
|
|
20096
|
+
async sendAction(action) {
|
|
20097
|
+
var _a;
|
|
20098
|
+
const message = (0, sprotty_protocol_1.isActionMessage)(action) ? action : {
|
|
20099
|
+
clientId: (_a = this.diagramIdentifier) === null || _a === void 0 ? void 0 : _a.clientId,
|
|
20100
|
+
action
|
|
20101
|
+
};
|
|
20102
|
+
const handlers = this.actionHandlers.get(message.action.kind);
|
|
20103
|
+
if (handlers && handlers.length > 0) {
|
|
20104
|
+
return Promise.all(handlers.map((handler) => handler(message.action)));
|
|
20105
|
+
}
|
|
20106
|
+
this.messenger.sendNotification(sprotty_vscode_protocol_1.ActionNotification, this.messageParticipant, message);
|
|
20107
|
+
}
|
|
20108
|
+
/**
|
|
20109
|
+
* Process an action received from the webview.
|
|
20110
|
+
*/
|
|
20111
|
+
receiveAction(message) {
|
|
20112
|
+
const action = message.action;
|
|
20113
|
+
const handlers = this.actionHandlers.get(action.kind);
|
|
20114
|
+
if (handlers && handlers.length > 0) {
|
|
20115
|
+
return Promise.all(handlers.map((handler) => handler(action)));
|
|
20116
|
+
}
|
|
20117
|
+
if (this.diagramServer) {
|
|
20118
|
+
return this.diagramServer.accept(action);
|
|
20119
|
+
}
|
|
20120
|
+
return Promise.resolve();
|
|
20121
|
+
}
|
|
20122
|
+
/**
|
|
20123
|
+
* Add an action handler for actions that are sent or received. If one or more handlers are registered for an
|
|
20124
|
+
* action kind, the corresponding actions are sent to those handlers and are not propagated further.
|
|
20125
|
+
*/
|
|
20126
|
+
addActionHandler(kind, handler) {
|
|
20127
|
+
const handlers = this.actionHandlers.get(kind);
|
|
20128
|
+
if (handlers) {
|
|
20129
|
+
handlers.push(handler);
|
|
20130
|
+
} else {
|
|
20131
|
+
this.actionHandlers.set(kind, [handler]);
|
|
20132
|
+
}
|
|
20133
|
+
}
|
|
20134
|
+
/**
|
|
20135
|
+
* Remove a previously registered action handler.
|
|
20136
|
+
*/
|
|
20137
|
+
removeActionHandler(kind, handler) {
|
|
20138
|
+
const handlers = this.actionHandlers.get(kind);
|
|
20139
|
+
if (handlers) {
|
|
20140
|
+
const index = handlers.indexOf(handler);
|
|
20141
|
+
if (index >= 0) {
|
|
20142
|
+
handlers.splice(index, 1);
|
|
20143
|
+
}
|
|
20144
|
+
}
|
|
20145
|
+
}
|
|
20146
|
+
};
|
|
20147
|
+
exports2.WebviewEndpoint = WebviewEndpoint;
|
|
20148
|
+
}
|
|
20149
|
+
});
|
|
20150
|
+
|
|
20151
|
+
// node_modules/sprotty-vscode/lib/webview-utils.js
|
|
20152
|
+
var require_webview_utils = __commonJS({
|
|
20153
|
+
"node_modules/sprotty-vscode/lib/webview-utils.js"(exports2) {
|
|
20154
|
+
"use strict";
|
|
20155
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20156
|
+
exports2.getExtname = exports2.getBasename = exports2.createFileUri = exports2.createWebviewHtml = exports2.createWebviewTitle = exports2.createWebviewPanel = exports2.serializeUri = void 0;
|
|
20157
|
+
var path2 = require("path");
|
|
20158
|
+
var vscode2 = require("vscode");
|
|
20159
|
+
function serializeUri(uri) {
|
|
20160
|
+
let uriString = uri.toString();
|
|
20161
|
+
const matchDrive = uriString.match(/^file:\/\/\/([a-z])%3A/i);
|
|
20162
|
+
if (matchDrive) {
|
|
20163
|
+
uriString = "file:///" + matchDrive[1] + ":" + uriString.substring(matchDrive[0].length);
|
|
20164
|
+
}
|
|
20165
|
+
return uriString;
|
|
20166
|
+
}
|
|
20167
|
+
exports2.serializeUri = serializeUri;
|
|
20168
|
+
function createWebviewPanel(identifier, options) {
|
|
20169
|
+
const title = createWebviewTitle(identifier);
|
|
20170
|
+
const diagramPanel = vscode2.window.createWebviewPanel(identifier.diagramType || "diagram", title, vscode2.ViewColumn.Beside, {
|
|
20171
|
+
localResourceRoots: options.localResourceRoots,
|
|
20172
|
+
enableScripts: true,
|
|
20173
|
+
retainContextWhenHidden: true
|
|
20174
|
+
});
|
|
20175
|
+
diagramPanel.webview.html = createWebviewHtml(identifier, diagramPanel, {
|
|
20176
|
+
scriptUri: options.scriptUri,
|
|
20177
|
+
cssUri: options.cssUri,
|
|
20178
|
+
title
|
|
20179
|
+
});
|
|
20180
|
+
return diagramPanel;
|
|
20181
|
+
}
|
|
20182
|
+
exports2.createWebviewPanel = createWebviewPanel;
|
|
20183
|
+
function createWebviewTitle(identifier) {
|
|
20184
|
+
if (identifier.uri) {
|
|
20185
|
+
const uri = vscode2.Uri.parse(identifier.uri);
|
|
20186
|
+
return getBasename(uri);
|
|
20187
|
+
} else if (identifier.diagramType) {
|
|
20188
|
+
return identifier.diagramType.charAt(0).toUpperCase() + identifier.diagramType.substring(1);
|
|
20189
|
+
} else {
|
|
20190
|
+
return "Diagram";
|
|
20191
|
+
}
|
|
20192
|
+
}
|
|
20193
|
+
exports2.createWebviewTitle = createWebviewTitle;
|
|
20194
|
+
function createWebviewHtml(identifier, container, options) {
|
|
20195
|
+
const transformUri = (uri) => container.webview.asWebviewUri(uri).toString();
|
|
20196
|
+
return `<!DOCTYPE html>
|
|
20197
|
+
<html lang="en">
|
|
20198
|
+
<head>
|
|
20199
|
+
<meta charset="UTF-8">
|
|
20200
|
+
<meta name="viewport" content="width=device-width, height=device-height">
|
|
20201
|
+
${options.title ? `<title>${options.title}</title>` : ""}
|
|
20202
|
+
${options.cssUri ? `<link rel="stylesheet" type="text/css" href="${transformUri(options.cssUri)}" />` : ""}
|
|
20203
|
+
</head>
|
|
20204
|
+
<body>
|
|
20205
|
+
<div id="${identifier.clientId}_container" style="height: 100%;"></div>
|
|
20206
|
+
<script src="${transformUri(options.scriptUri)}"></script>
|
|
20207
|
+
</body>
|
|
20208
|
+
</html>`;
|
|
20209
|
+
}
|
|
20210
|
+
exports2.createWebviewHtml = createWebviewHtml;
|
|
20211
|
+
function createFileUri2(...segments) {
|
|
20212
|
+
return vscode2.Uri.file(path2.join(...segments));
|
|
20213
|
+
}
|
|
20214
|
+
exports2.createFileUri = createFileUri2;
|
|
20215
|
+
function getBasename(uri) {
|
|
20216
|
+
const slashIndex = uri.path.lastIndexOf("/");
|
|
20217
|
+
return uri.path.substring(slashIndex + 1);
|
|
20218
|
+
}
|
|
20219
|
+
exports2.getBasename = getBasename;
|
|
20220
|
+
function getExtname(uri) {
|
|
20221
|
+
const basename = getBasename(uri);
|
|
20222
|
+
const dotIndex = basename.lastIndexOf(".");
|
|
20223
|
+
if (dotIndex <= 0) {
|
|
20224
|
+
return "";
|
|
20225
|
+
}
|
|
20226
|
+
return basename.substring(dotIndex);
|
|
20227
|
+
}
|
|
20228
|
+
exports2.getExtname = getExtname;
|
|
20229
|
+
}
|
|
20230
|
+
});
|
|
20231
|
+
|
|
20232
|
+
// node_modules/sprotty-vscode/lib/sprotty-editor-provider.js
|
|
20233
|
+
var require_sprotty_editor_provider = __commonJS({
|
|
20234
|
+
"node_modules/sprotty-vscode/lib/sprotty-editor-provider.js"(exports2) {
|
|
20235
|
+
"use strict";
|
|
20236
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20237
|
+
exports2.SprottyEditorProvider = void 0;
|
|
20238
|
+
var vscode2 = require("vscode");
|
|
20239
|
+
var vscode_messenger_1 = require_lib2();
|
|
20240
|
+
var webview_endpoint_1 = require_webview_endpoint();
|
|
20241
|
+
var webview_utils_1 = require_webview_utils();
|
|
20242
|
+
var SprottyEditorProvider = class _SprottyEditorProvider {
|
|
20243
|
+
get onDidChangeCustomDocument() {
|
|
20244
|
+
return this.changeEmitter.event;
|
|
20245
|
+
}
|
|
20246
|
+
constructor(options) {
|
|
20247
|
+
var _a;
|
|
20248
|
+
this.options = options;
|
|
20249
|
+
this.changeEmitter = new vscode2.EventEmitter();
|
|
20250
|
+
this.documents = [];
|
|
20251
|
+
this.messenger = (_a = options.messenger) !== null && _a !== void 0 ? _a : new vscode_messenger_1.Messenger();
|
|
20252
|
+
}
|
|
20253
|
+
/**
|
|
20254
|
+
* Find the webview endpoint of a custom editor that is currently active.
|
|
20255
|
+
*/
|
|
20256
|
+
findActiveWebview() {
|
|
20257
|
+
for (const document of this.documents) {
|
|
20258
|
+
if (document.endpoint && (0, webview_endpoint_1.isWebviewPanel)(document.endpoint.webviewContainer) && document.endpoint.webviewContainer.active) {
|
|
20259
|
+
return document.endpoint;
|
|
20260
|
+
}
|
|
20261
|
+
}
|
|
20262
|
+
return void 0;
|
|
20263
|
+
}
|
|
20264
|
+
/**
|
|
20265
|
+
* Open a custom editor for the given URI.
|
|
20266
|
+
*/
|
|
20267
|
+
async openDiagram(uri, options) {
|
|
20268
|
+
await vscode2.commands.executeCommand("vscode.openWith", uri, this.options.viewType);
|
|
20269
|
+
return void 0;
|
|
20270
|
+
}
|
|
20271
|
+
openCustomDocument(uri, openContext, cancelToken) {
|
|
20272
|
+
const document = {
|
|
20273
|
+
uri,
|
|
20274
|
+
dispose: () => this.disposeDocument(document)
|
|
20275
|
+
};
|
|
20276
|
+
this.documents.push(document);
|
|
20277
|
+
return document;
|
|
20278
|
+
}
|
|
20279
|
+
disposeDocument(document) {
|
|
20280
|
+
const index = this.documents.indexOf(document);
|
|
20281
|
+
if (index >= 0) {
|
|
20282
|
+
this.documents.splice(index, 1);
|
|
20283
|
+
}
|
|
20284
|
+
}
|
|
20285
|
+
async resolveCustomEditor(document, webviewPanel, cancelToken) {
|
|
20286
|
+
const identifier = await this.createDiagramIdentifier(document);
|
|
20287
|
+
if (!identifier) {
|
|
20288
|
+
throw new Error(`Document type not supported: ${document.uri.toString(true)}`);
|
|
20289
|
+
}
|
|
20290
|
+
document.endpoint = this.createEndpoint(identifier, webviewPanel);
|
|
20291
|
+
await this.configureWebview(document, webviewPanel, cancelToken);
|
|
20292
|
+
}
|
|
20293
|
+
createEndpoint(identifier, webviewContainer) {
|
|
20294
|
+
const participant = this.messenger.registerWebviewPanel(webviewContainer);
|
|
20295
|
+
return new webview_endpoint_1.WebviewEndpoint({
|
|
20296
|
+
webviewContainer,
|
|
20297
|
+
messenger: this.messenger,
|
|
20298
|
+
messageParticipant: participant,
|
|
20299
|
+
identifier
|
|
20300
|
+
});
|
|
20301
|
+
}
|
|
20302
|
+
/**
|
|
20303
|
+
* Configure the given webview panel. The default implementation sets `localResourceRoots` to the `pack` subfolder of the extension host
|
|
20304
|
+
* and `scriptUri` to `pack/webview.js`. Please configure your bundler to generate such an output file from the Sprotty webview frontend.
|
|
20305
|
+
* In case you need to use different settings or change the HTML content, you can override this functionality in a subclass.
|
|
20306
|
+
*/
|
|
20307
|
+
configureWebview(document, webviewPanel, cancelToken) {
|
|
20308
|
+
var _a;
|
|
20309
|
+
const extensionPath = this.options.extensionUri.fsPath;
|
|
20310
|
+
webviewPanel.webview.options = {
|
|
20311
|
+
localResourceRoots: [(0, webview_utils_1.createFileUri)(extensionPath, "pack")],
|
|
20312
|
+
enableScripts: true
|
|
20313
|
+
};
|
|
20314
|
+
const identifier = (_a = document.endpoint) === null || _a === void 0 ? void 0 : _a.diagramIdentifier;
|
|
20315
|
+
if (identifier) {
|
|
20316
|
+
const scriptUri = (0, webview_utils_1.createFileUri)(extensionPath, "pack", "webview.js");
|
|
20317
|
+
webviewPanel.webview.html = (0, webview_utils_1.createWebviewHtml)(identifier, webviewPanel, { scriptUri });
|
|
20318
|
+
}
|
|
20319
|
+
}
|
|
20320
|
+
async createDiagramIdentifier(document, diagramType) {
|
|
20321
|
+
if (!diagramType) {
|
|
20322
|
+
diagramType = await this.getDiagramType(document.uri);
|
|
20323
|
+
if (!diagramType) {
|
|
20324
|
+
return void 0;
|
|
20325
|
+
}
|
|
20326
|
+
}
|
|
20327
|
+
const clientId = diagramType + "_" + _SprottyEditorProvider.viewCount++;
|
|
20328
|
+
return {
|
|
20329
|
+
diagramType,
|
|
20330
|
+
uri: (0, webview_utils_1.serializeUri)(document.uri),
|
|
20331
|
+
clientId
|
|
20332
|
+
};
|
|
20333
|
+
}
|
|
20334
|
+
/**
|
|
20335
|
+
* Determine a diagram type from the given URI. The default implementation returns the `viewType` of the custom
|
|
20336
|
+
* editor if the URI matches the `supportedFileExtensions` or no file extensions were provided.
|
|
20337
|
+
*/
|
|
20338
|
+
getDiagramType(uri) {
|
|
20339
|
+
const extname = (0, webview_utils_1.getExtname)(uri);
|
|
20340
|
+
if (!this.options.supportedFileExtensions || this.options.supportedFileExtensions.includes(extname)) {
|
|
20341
|
+
return this.options.viewType;
|
|
20342
|
+
}
|
|
20343
|
+
}
|
|
20344
|
+
saveCustomDocument(document, cancellation) {
|
|
20345
|
+
return Promise.resolve();
|
|
20346
|
+
}
|
|
20347
|
+
revertCustomDocument(document, cancelToken) {
|
|
20348
|
+
return Promise.resolve();
|
|
20349
|
+
}
|
|
20350
|
+
saveCustomDocumentAs(document, destination, cancelToken) {
|
|
20351
|
+
return Promise.reject("Operation not supported.");
|
|
20352
|
+
}
|
|
20353
|
+
backupCustomDocument(document, context, cancelToken) {
|
|
20354
|
+
return Promise.reject("Operation not supported.");
|
|
20355
|
+
}
|
|
20356
|
+
};
|
|
20357
|
+
exports2.SprottyEditorProvider = SprottyEditorProvider;
|
|
20358
|
+
SprottyEditorProvider.viewCount = 0;
|
|
20359
|
+
}
|
|
20360
|
+
});
|
|
20361
|
+
|
|
20362
|
+
// node_modules/sprotty-vscode/lib/sprotty-view-provider.js
|
|
20363
|
+
var require_sprotty_view_provider = __commonJS({
|
|
20364
|
+
"node_modules/sprotty-vscode/lib/sprotty-view-provider.js"(exports2) {
|
|
20365
|
+
"use strict";
|
|
20366
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20367
|
+
exports2.SprottyViewProvider = void 0;
|
|
20368
|
+
var vscode2 = require("vscode");
|
|
20369
|
+
var vscode_messenger_1 = require_lib2();
|
|
20370
|
+
var webview_endpoint_1 = require_webview_endpoint();
|
|
20371
|
+
var webview_utils_1 = require_webview_utils();
|
|
20372
|
+
var SprottyViewProvider = class _SprottyViewProvider {
|
|
20373
|
+
constructor(options) {
|
|
20374
|
+
var _a;
|
|
20375
|
+
this.options = options;
|
|
20376
|
+
this.clientId = options.viewType + "_" + _SprottyViewProvider.viewCount++;
|
|
20377
|
+
this.messenger = (_a = options.messenger) !== null && _a !== void 0 ? _a : new vscode_messenger_1.Messenger();
|
|
20378
|
+
}
|
|
20379
|
+
/**
|
|
20380
|
+
* Returns the webview endpoint of the created view if it is already opened.
|
|
20381
|
+
*/
|
|
20382
|
+
findActiveWebview() {
|
|
20383
|
+
return this.endpoint;
|
|
20384
|
+
}
|
|
20385
|
+
/**
|
|
20386
|
+
* Open the given URI in the view if it is already opened. There is currently no way to open the view
|
|
20387
|
+
* programmatically, so this method shows an error message if the view is not opened. The message can
|
|
20388
|
+
* be suppressed with the `quiet` option.
|
|
20389
|
+
*/
|
|
20390
|
+
async openDiagram(uri, options = {}) {
|
|
20391
|
+
const identifier = await this.createDiagramIdentifier(uri, options.diagramType);
|
|
20392
|
+
if (!identifier) {
|
|
20393
|
+
return void 0;
|
|
20394
|
+
}
|
|
20395
|
+
const endpoint = this.endpoint;
|
|
20396
|
+
if (endpoint) {
|
|
20397
|
+
endpoint.reloadContent(identifier);
|
|
20398
|
+
if (options.reveal && (0, webview_endpoint_1.isWebviewView)(endpoint.webviewContainer)) {
|
|
20399
|
+
endpoint.webviewContainer.show(options.preserveFocus);
|
|
20400
|
+
}
|
|
20401
|
+
} else {
|
|
20402
|
+
vscode2.commands.executeCommand(`${identifier.diagramType}.focus`);
|
|
20403
|
+
}
|
|
20404
|
+
return endpoint;
|
|
20405
|
+
}
|
|
20406
|
+
async resolveWebviewView(webviewView, context, cancelToken) {
|
|
20407
|
+
if (this.endpoint) {
|
|
20408
|
+
console.warn("Warning: Sprotty webview-view is already resolved.");
|
|
20409
|
+
}
|
|
20410
|
+
let identifier;
|
|
20411
|
+
if (this.options.openActiveEditor) {
|
|
20412
|
+
const editor = vscode2.window.activeTextEditor;
|
|
20413
|
+
if (editor) {
|
|
20414
|
+
identifier = await this.createDiagramIdentifier(editor.document.uri);
|
|
20415
|
+
}
|
|
20416
|
+
}
|
|
20417
|
+
const endpoint = this.createEndpoint(webviewView, identifier);
|
|
20418
|
+
this.configureWebview(webviewView, endpoint, cancelToken);
|
|
20419
|
+
this.endpoint = endpoint;
|
|
20420
|
+
webviewView.onDidDispose(() => this.didCloseWebview(endpoint));
|
|
20421
|
+
}
|
|
20422
|
+
createEndpoint(webviewContainer, identifier) {
|
|
20423
|
+
const participant = this.messenger.registerWebviewView(webviewContainer);
|
|
20424
|
+
return new webview_endpoint_1.WebviewEndpoint({
|
|
20425
|
+
webviewContainer,
|
|
20426
|
+
messenger: this.messenger,
|
|
20427
|
+
messageParticipant: participant,
|
|
20428
|
+
identifier
|
|
20429
|
+
});
|
|
20430
|
+
}
|
|
20431
|
+
/**
|
|
20432
|
+
* Configure the given webview view. The default implementation sets `localResourceRoots` to the `pack` subfolder of the extension host
|
|
20433
|
+
* and `scriptUri` to `pack/webview.js`. Please configure your bundler to generate such an output file from the Sprotty webview frontend.
|
|
20434
|
+
* In case you need to use different settings or change the HTML content, you can override this functionality in a subclass.
|
|
20435
|
+
*/
|
|
20436
|
+
configureWebview(webviewView, endpoint, cancelToken) {
|
|
20437
|
+
const extensionPath = this.options.extensionUri.fsPath;
|
|
20438
|
+
webviewView.webview.options = {
|
|
20439
|
+
localResourceRoots: [(0, webview_utils_1.createFileUri)(extensionPath, "pack")],
|
|
20440
|
+
enableScripts: true
|
|
20441
|
+
};
|
|
20442
|
+
let identifier = endpoint.diagramIdentifier;
|
|
20443
|
+
if (!identifier) {
|
|
20444
|
+
identifier = { clientId: this.clientId, diagramType: this.options.viewType, uri: "" };
|
|
20445
|
+
}
|
|
20446
|
+
const scriptUri = (0, webview_utils_1.createFileUri)(extensionPath, "pack", "webview.js");
|
|
20447
|
+
webviewView.webview.html = (0, webview_utils_1.createWebviewHtml)(identifier, webviewView, { scriptUri });
|
|
20448
|
+
}
|
|
20449
|
+
async createDiagramIdentifier(uri, diagramType) {
|
|
20450
|
+
if (!diagramType) {
|
|
20451
|
+
diagramType = await this.getDiagramType(uri);
|
|
20452
|
+
if (!diagramType) {
|
|
20453
|
+
return void 0;
|
|
20454
|
+
}
|
|
20455
|
+
}
|
|
20456
|
+
return {
|
|
20457
|
+
diagramType,
|
|
20458
|
+
uri: (0, webview_utils_1.serializeUri)(uri),
|
|
20459
|
+
clientId: this.clientId
|
|
20460
|
+
};
|
|
20461
|
+
}
|
|
20462
|
+
/**
|
|
20463
|
+
* Determine a diagram type from the given URI. The default implementation returns the `viewType` of the view
|
|
20464
|
+
* if the URI matches the `supportedFileExtensions` or no file extensions were provided.
|
|
20465
|
+
*/
|
|
20466
|
+
getDiagramType(uri) {
|
|
20467
|
+
const extname = (0, webview_utils_1.getExtname)(uri);
|
|
20468
|
+
if (!this.options.supportedFileExtensions || this.options.supportedFileExtensions.includes(extname)) {
|
|
20469
|
+
return this.options.viewType;
|
|
20470
|
+
}
|
|
20471
|
+
}
|
|
20472
|
+
didCloseWebview(endpoint) {
|
|
20473
|
+
if (this.endpoint === endpoint) {
|
|
20474
|
+
this.endpoint = void 0;
|
|
20475
|
+
}
|
|
20476
|
+
}
|
|
20477
|
+
};
|
|
20478
|
+
exports2.SprottyViewProvider = SprottyViewProvider;
|
|
20479
|
+
SprottyViewProvider.viewCount = 0;
|
|
20480
|
+
}
|
|
20481
|
+
});
|
|
20482
|
+
|
|
20483
|
+
// node_modules/sprotty-vscode/lib/webview-panel-manager.js
|
|
20484
|
+
var require_webview_panel_manager = __commonJS({
|
|
20485
|
+
"node_modules/sprotty-vscode/lib/webview-panel-manager.js"(exports2) {
|
|
20486
|
+
"use strict";
|
|
20487
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20488
|
+
exports2.WebviewPanelManager = void 0;
|
|
20489
|
+
var vscode_messenger_1 = require_lib2();
|
|
20490
|
+
var webview_endpoint_1 = require_webview_endpoint();
|
|
20491
|
+
var webview_utils_1 = require_webview_utils();
|
|
20492
|
+
var WebviewPanelManager = class _WebviewPanelManager {
|
|
20493
|
+
constructor(options) {
|
|
20494
|
+
var _a;
|
|
20495
|
+
this.options = options;
|
|
20496
|
+
this.endpoints = [];
|
|
20497
|
+
this.messenger = (_a = options.messenger) !== null && _a !== void 0 ? _a : new vscode_messenger_1.Messenger();
|
|
20498
|
+
}
|
|
20499
|
+
/**
|
|
20500
|
+
* Find the webview endpoint of a webview panel that is currently active.
|
|
20501
|
+
*/
|
|
20502
|
+
findActiveWebview() {
|
|
20503
|
+
for (const endpoint of this.endpoints) {
|
|
20504
|
+
if ((0, webview_endpoint_1.isWebviewPanel)(endpoint.webviewContainer) && endpoint.webviewContainer.active) {
|
|
20505
|
+
return endpoint;
|
|
20506
|
+
}
|
|
20507
|
+
}
|
|
20508
|
+
return void 0;
|
|
20509
|
+
}
|
|
20510
|
+
/**
|
|
20511
|
+
* Open a webview panel for the given URI. Depending on the `singleton` option, this either replaces a
|
|
20512
|
+
* previously opened diagram or creates a new panel.
|
|
20513
|
+
*/
|
|
20514
|
+
async openDiagram(uri, options = {}) {
|
|
20515
|
+
const identifier = await this.createDiagramIdentifier(uri, options.diagramType);
|
|
20516
|
+
if (!identifier) {
|
|
20517
|
+
return void 0;
|
|
20518
|
+
}
|
|
20519
|
+
let endpoint = this.options.singleton ? this.endpoints[0] : this.endpoints.find((ep) => {
|
|
20520
|
+
var _a, _b;
|
|
20521
|
+
return ((_a = ep.diagramIdentifier) === null || _a === void 0 ? void 0 : _a.uri) === identifier.uri && ((_b = ep.diagramIdentifier) === null || _b === void 0 ? void 0 : _b.diagramType) === identifier.diagramType;
|
|
20522
|
+
});
|
|
20523
|
+
if (endpoint) {
|
|
20524
|
+
if (endpoint.diagramIdentifier) {
|
|
20525
|
+
identifier.clientId = endpoint.diagramIdentifier.clientId;
|
|
20526
|
+
}
|
|
20527
|
+
endpoint.webviewContainer.title = (0, webview_utils_1.createWebviewTitle)(identifier);
|
|
20528
|
+
endpoint.reloadContent(identifier);
|
|
20529
|
+
if (options.reveal && (0, webview_endpoint_1.isWebviewPanel)(endpoint.webviewContainer)) {
|
|
20530
|
+
endpoint.webviewContainer.reveal(endpoint.webviewContainer.viewColumn, options.preserveFocus);
|
|
20531
|
+
}
|
|
20532
|
+
} else {
|
|
20533
|
+
endpoint = this.createEndpoint(identifier);
|
|
20534
|
+
endpoint.webviewContainer.onDidDispose(() => this.didCloseWebview(endpoint));
|
|
20535
|
+
this.endpoints.push(endpoint);
|
|
20536
|
+
}
|
|
20537
|
+
return endpoint;
|
|
20538
|
+
}
|
|
20539
|
+
createEndpoint(identifier) {
|
|
20540
|
+
const webviewContainer = this.createWebview(identifier);
|
|
20541
|
+
const participant = this.messenger.registerWebviewPanel(webviewContainer);
|
|
20542
|
+
return new webview_endpoint_1.WebviewEndpoint({
|
|
20543
|
+
webviewContainer,
|
|
20544
|
+
messenger: this.messenger,
|
|
20545
|
+
messageParticipant: participant,
|
|
20546
|
+
identifier
|
|
20547
|
+
});
|
|
20548
|
+
}
|
|
20549
|
+
/**
|
|
20550
|
+
* Create and configure a webview panel. The default implementation sets `localResourceRoots` to the `pack` subfolder of the extension
|
|
20551
|
+
* host and `scriptUri` to `pack/webview.js`. Please configure your bundler to generate such an output file from the Sprotty webview
|
|
20552
|
+
* frontend. In case you need to use different settings or change the HTML content, you can override this functionality in a subclass.
|
|
20553
|
+
*/
|
|
20554
|
+
createWebview(identifier) {
|
|
20555
|
+
const extensionPath = this.options.extensionUri.fsPath;
|
|
20556
|
+
return (0, webview_utils_1.createWebviewPanel)(identifier, {
|
|
20557
|
+
localResourceRoots: [(0, webview_utils_1.createFileUri)(extensionPath, "pack")],
|
|
20558
|
+
scriptUri: (0, webview_utils_1.createFileUri)(extensionPath, "pack", "webview.js")
|
|
20559
|
+
});
|
|
20560
|
+
}
|
|
20561
|
+
async createDiagramIdentifier(uri, diagramType) {
|
|
20562
|
+
if (!diagramType) {
|
|
20563
|
+
diagramType = await this.getDiagramType(uri);
|
|
20564
|
+
if (!diagramType) {
|
|
20565
|
+
return void 0;
|
|
20566
|
+
}
|
|
20567
|
+
}
|
|
20568
|
+
const clientId = diagramType + "_" + _WebviewPanelManager.viewCount++;
|
|
20569
|
+
return {
|
|
20570
|
+
diagramType,
|
|
20571
|
+
uri: (0, webview_utils_1.serializeUri)(uri),
|
|
20572
|
+
clientId
|
|
20573
|
+
};
|
|
20574
|
+
}
|
|
20575
|
+
/**
|
|
20576
|
+
* Determine a diagram type from the given URI. The default implementation returns the `defaultDiagramType` option
|
|
20577
|
+
* if the URI matches the `supportedFileExtensions` or no file extensions were provided. If no default diagram type
|
|
20578
|
+
* was provided, the file extension is used instead.
|
|
20579
|
+
*/
|
|
20580
|
+
getDiagramType(uri) {
|
|
20581
|
+
const extname = (0, webview_utils_1.getExtname)(uri);
|
|
20582
|
+
if (!this.options.supportedFileExtensions || this.options.supportedFileExtensions.includes(extname)) {
|
|
20583
|
+
if (this.options.defaultDiagramType) {
|
|
20584
|
+
return this.options.defaultDiagramType;
|
|
20585
|
+
}
|
|
20586
|
+
if (extname.length >= 2) {
|
|
20587
|
+
return extname.substring(1);
|
|
20588
|
+
}
|
|
20589
|
+
}
|
|
20590
|
+
}
|
|
20591
|
+
didCloseWebview(endpoint) {
|
|
20592
|
+
const index = this.endpoints.indexOf(endpoint);
|
|
20593
|
+
if (index >= 0) {
|
|
20594
|
+
this.endpoints.splice(index, 1);
|
|
20595
|
+
}
|
|
20596
|
+
}
|
|
20597
|
+
};
|
|
20598
|
+
exports2.WebviewPanelManager = WebviewPanelManager;
|
|
20599
|
+
WebviewPanelManager.viewCount = 0;
|
|
20600
|
+
}
|
|
20601
|
+
});
|
|
20602
|
+
|
|
20603
|
+
// node_modules/sprotty-vscode/lib/index.js
|
|
20604
|
+
var require_lib5 = __commonJS({
|
|
20605
|
+
"node_modules/sprotty-vscode/lib/index.js"(exports2) {
|
|
20606
|
+
"use strict";
|
|
20607
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
20608
|
+
if (k2 === void 0)
|
|
20609
|
+
k2 = k;
|
|
20610
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20611
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20612
|
+
desc = { enumerable: true, get: function() {
|
|
20613
|
+
return m[k];
|
|
20614
|
+
} };
|
|
20615
|
+
}
|
|
20616
|
+
Object.defineProperty(o, k2, desc);
|
|
20617
|
+
} : function(o, m, k, k2) {
|
|
20618
|
+
if (k2 === void 0)
|
|
20619
|
+
k2 = k;
|
|
20620
|
+
o[k2] = m[k];
|
|
20621
|
+
});
|
|
20622
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
20623
|
+
for (var p in m)
|
|
20624
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
20625
|
+
__createBinding(exports3, m, p);
|
|
20626
|
+
};
|
|
20627
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20628
|
+
__exportStar(require_default_contributions(), exports2);
|
|
20629
|
+
__exportStar(require_sprotty_editor_provider(), exports2);
|
|
20630
|
+
__exportStar(require_sprotty_view_provider(), exports2);
|
|
20631
|
+
__exportStar(require_webview_endpoint(), exports2);
|
|
20632
|
+
__exportStar(require_webview_panel_manager(), exports2);
|
|
20633
|
+
__exportStar(require_webview_utils(), exports2);
|
|
20634
|
+
__exportStar(require_lib4(), exports2);
|
|
20635
|
+
}
|
|
20636
|
+
});
|
|
20637
|
+
|
|
20638
|
+
// node_modules/sprotty-vscode/lib/lsp/lsp-utils.js
|
|
20639
|
+
var require_lsp_utils = __commonJS({
|
|
20640
|
+
"node_modules/sprotty-vscode/lib/lsp/lsp-utils.js"(exports2) {
|
|
20641
|
+
"use strict";
|
|
20642
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20643
|
+
exports2.openInTextEditor = exports2.convertUri = exports2.convertPosition = exports2.convertRange = exports2.convertTextEdit = exports2.convertWorkspaceEdit = void 0;
|
|
20644
|
+
var vscode2 = require("vscode");
|
|
20645
|
+
var lsp = require_main4();
|
|
20646
|
+
function convertWorkspaceEdit(workspaceEdit) {
|
|
20647
|
+
var _a;
|
|
20648
|
+
const result = new vscode2.WorkspaceEdit();
|
|
20649
|
+
const changes = workspaceEdit.changes;
|
|
20650
|
+
if (changes) {
|
|
20651
|
+
for (const uri in changes) {
|
|
20652
|
+
const textEdits = changes[uri];
|
|
20653
|
+
if (Array.isArray(textEdits)) {
|
|
20654
|
+
result.set(convertUri(uri), textEdits.map(convertTextEdit));
|
|
20655
|
+
}
|
|
20656
|
+
}
|
|
20657
|
+
}
|
|
20658
|
+
(_a = workspaceEdit.documentChanges) === null || _a === void 0 ? void 0 : _a.forEach((documentChange) => {
|
|
20659
|
+
if (lsp.TextDocumentEdit.is(documentChange)) {
|
|
20660
|
+
result.set(convertUri(documentChange.textDocument.uri), documentChange.edits.map(convertTextEdit));
|
|
20661
|
+
} else if (lsp.CreateFile.is(documentChange)) {
|
|
20662
|
+
result.createFile(convertUri(documentChange.uri), documentChange.options);
|
|
20663
|
+
} else if (lsp.DeleteFile.is(documentChange)) {
|
|
20664
|
+
result.deleteFile(convertUri(documentChange.uri), documentChange.options);
|
|
20665
|
+
} else if (lsp.RenameFile.is(documentChange)) {
|
|
20666
|
+
result.renameFile(convertUri(documentChange.oldUri), convertUri(documentChange.newUri), documentChange.options);
|
|
20667
|
+
}
|
|
20668
|
+
});
|
|
20669
|
+
return result;
|
|
20670
|
+
}
|
|
20671
|
+
exports2.convertWorkspaceEdit = convertWorkspaceEdit;
|
|
20672
|
+
function convertTextEdit(textEdit) {
|
|
20673
|
+
return new vscode2.TextEdit(convertRange(textEdit.range), textEdit.newText);
|
|
20674
|
+
}
|
|
20675
|
+
exports2.convertTextEdit = convertTextEdit;
|
|
20676
|
+
function convertRange(range) {
|
|
20677
|
+
return new vscode2.Range(convertPosition(range.start), convertPosition(range.end));
|
|
20678
|
+
}
|
|
20679
|
+
exports2.convertRange = convertRange;
|
|
20680
|
+
function convertPosition(position) {
|
|
20681
|
+
return new vscode2.Position(position.line, position.character);
|
|
20682
|
+
}
|
|
20683
|
+
exports2.convertPosition = convertPosition;
|
|
20684
|
+
function convertUri(uri) {
|
|
20685
|
+
return vscode2.Uri.parse(uri);
|
|
20686
|
+
}
|
|
20687
|
+
exports2.convertUri = convertUri;
|
|
20688
|
+
function openInTextEditor(message) {
|
|
20689
|
+
const editor = vscode2.window.visibleTextEditors.find((ed) => ed.document.uri.toString() === message.location.uri);
|
|
20690
|
+
if (editor) {
|
|
20691
|
+
const start = convertPosition(message.location.range.start);
|
|
20692
|
+
const end = convertPosition(message.location.range.end);
|
|
20693
|
+
editor.selection = new vscode2.Selection(start, end);
|
|
20694
|
+
editor.revealRange(editor.selection, vscode2.TextEditorRevealType.InCenter);
|
|
20695
|
+
} else if (message.forceOpen) {
|
|
20696
|
+
vscode2.window.showTextDocument(vscode2.Uri.parse(message.location.uri), {
|
|
20697
|
+
selection: new vscode2.Range(convertPosition(message.location.range.start), convertPosition(message.location.range.end)),
|
|
20698
|
+
viewColumn: vscode2.ViewColumn.One
|
|
20699
|
+
});
|
|
20700
|
+
}
|
|
20701
|
+
}
|
|
20702
|
+
exports2.openInTextEditor = openInTextEditor;
|
|
20703
|
+
}
|
|
20704
|
+
});
|
|
20705
|
+
|
|
20706
|
+
// node_modules/sprotty-vscode-protocol/lib/lsp/messages.js
|
|
20707
|
+
var require_messages4 = __commonJS({
|
|
20708
|
+
"node_modules/sprotty-vscode-protocol/lib/lsp/messages.js"(exports2) {
|
|
20709
|
+
"use strict";
|
|
20710
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20711
|
+
exports2.LspRequest = exports2.LspNotification = void 0;
|
|
20712
|
+
exports2.LspNotification = { method: "LspNotification" };
|
|
20713
|
+
exports2.LspRequest = { method: "LspRequest" };
|
|
20714
|
+
}
|
|
20715
|
+
});
|
|
20716
|
+
|
|
20717
|
+
// node_modules/sprotty-vscode-protocol/lib/lsp/index.js
|
|
20718
|
+
var require_lsp = __commonJS({
|
|
20719
|
+
"node_modules/sprotty-vscode-protocol/lib/lsp/index.js"(exports2) {
|
|
20720
|
+
"use strict";
|
|
20721
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
20722
|
+
if (k2 === void 0)
|
|
20723
|
+
k2 = k;
|
|
20724
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20725
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20726
|
+
desc = { enumerable: true, get: function() {
|
|
20727
|
+
return m[k];
|
|
20728
|
+
} };
|
|
20729
|
+
}
|
|
20730
|
+
Object.defineProperty(o, k2, desc);
|
|
20731
|
+
} : function(o, m, k, k2) {
|
|
20732
|
+
if (k2 === void 0)
|
|
20733
|
+
k2 = k;
|
|
20734
|
+
o[k2] = m[k];
|
|
20735
|
+
});
|
|
20736
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
20737
|
+
for (var p in m)
|
|
20738
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
|
|
20739
|
+
__createBinding(exports3, m, p);
|
|
20740
|
+
};
|
|
20741
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20742
|
+
__exportStar(require_messages4(), exports2);
|
|
20743
|
+
}
|
|
20744
|
+
});
|
|
20745
|
+
|
|
20746
|
+
// node_modules/sprotty-vscode/lib/lsp/protocol.js
|
|
20747
|
+
var require_protocol2 = __commonJS({
|
|
20748
|
+
"node_modules/sprotty-vscode/lib/lsp/protocol.js"(exports2) {
|
|
20749
|
+
"use strict";
|
|
20750
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20751
|
+
exports2.openInTextEditorMessageType = exports2.didCloseMessageType = exports2.acceptMessageType = void 0;
|
|
20752
|
+
var vscode_languageclient_1 = require_main4();
|
|
20753
|
+
exports2.acceptMessageType = new vscode_languageclient_1.NotificationType("diagram/accept");
|
|
20754
|
+
exports2.didCloseMessageType = new vscode_languageclient_1.NotificationType("diagram/didClose");
|
|
20755
|
+
exports2.openInTextEditorMessageType = new vscode_languageclient_1.NotificationType("diagram/openInTextEditor");
|
|
20756
|
+
}
|
|
20757
|
+
});
|
|
20758
|
+
|
|
20759
|
+
// node_modules/sprotty-vscode/lib/lsp/lsp-webview-endpoint.js
|
|
20760
|
+
var require_lsp_webview_endpoint = __commonJS({
|
|
20761
|
+
"node_modules/sprotty-vscode/lib/lsp/lsp-webview-endpoint.js"(exports2) {
|
|
20762
|
+
"use strict";
|
|
20763
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20764
|
+
exports2.LspWebviewEndpoint = void 0;
|
|
20765
|
+
var lsp_1 = require_lsp();
|
|
20766
|
+
var webview_endpoint_1 = require_webview_endpoint();
|
|
20767
|
+
var protocol_1 = require_protocol2();
|
|
20768
|
+
var LspWebviewEndpoint = class extends webview_endpoint_1.WebviewEndpoint {
|
|
20769
|
+
constructor(options) {
|
|
20770
|
+
super(options);
|
|
20771
|
+
this.languageClient = options.languageClient;
|
|
20772
|
+
}
|
|
20773
|
+
connect() {
|
|
20774
|
+
super.connect();
|
|
20775
|
+
this.disposables.push(this.messenger.onRequest(lsp_1.LspRequest, async (request) => {
|
|
20776
|
+
const result = request.params === void 0 ? await this.languageClient.sendRequest(request.method) : await this.languageClient.sendRequest(request.method, request.params);
|
|
20777
|
+
const response = {
|
|
20778
|
+
jsonrpc: "2.0",
|
|
20779
|
+
id: request.id,
|
|
20780
|
+
result
|
|
20781
|
+
};
|
|
20782
|
+
return response;
|
|
20783
|
+
}, { sender: this.messageParticipant }));
|
|
20784
|
+
this.disposables.push(this.messenger.onNotification(lsp_1.LspNotification, (notification) => {
|
|
20785
|
+
this.languageClient.sendNotification(notification.method, notification.params);
|
|
20786
|
+
}, { sender: this.messageParticipant }));
|
|
20787
|
+
}
|
|
20788
|
+
async receiveAction(message) {
|
|
20789
|
+
await super.receiveAction(message);
|
|
20790
|
+
await this.languageClient.sendNotification(protocol_1.acceptMessageType, message);
|
|
20791
|
+
}
|
|
20792
|
+
};
|
|
20793
|
+
exports2.LspWebviewEndpoint = LspWebviewEndpoint;
|
|
20794
|
+
}
|
|
20795
|
+
});
|
|
20796
|
+
|
|
20797
|
+
// node_modules/sprotty-vscode/lib/lsp/lsp-sprotty-view-provider.js
|
|
20798
|
+
var require_lsp_sprotty_view_provider = __commonJS({
|
|
20799
|
+
"node_modules/sprotty-vscode/lib/lsp/lsp-sprotty-view-provider.js"(exports2) {
|
|
20800
|
+
"use strict";
|
|
20801
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
20802
|
+
exports2.LspSprottyViewProvider = void 0;
|
|
20803
|
+
var sprotty_view_provider_1 = require_sprotty_view_provider();
|
|
20804
|
+
var lsp_utils_1 = require_lsp_utils();
|
|
20805
|
+
var lsp_webview_endpoint_1 = require_lsp_webview_endpoint();
|
|
20806
|
+
var protocol_1 = require_protocol2();
|
|
20807
|
+
var LspSprottyViewProvider2 = class extends sprotty_view_provider_1.SprottyViewProvider {
|
|
20808
|
+
constructor(options) {
|
|
20809
|
+
super(options);
|
|
20810
|
+
options.languageClient.onNotification(protocol_1.acceptMessageType, (message) => this.acceptFromLanguageServer(message));
|
|
20811
|
+
options.languageClient.onNotification(protocol_1.openInTextEditorMessageType, (message) => (0, lsp_utils_1.openInTextEditor)(message));
|
|
20812
|
+
}
|
|
20813
|
+
get languageClient() {
|
|
20814
|
+
return this.options.languageClient;
|
|
20815
|
+
}
|
|
20816
|
+
createEndpoint(webviewContainer, identifier) {
|
|
20817
|
+
const participant = this.messenger.registerWebviewView(webviewContainer);
|
|
20818
|
+
return new lsp_webview_endpoint_1.LspWebviewEndpoint({
|
|
20819
|
+
languageClient: this.languageClient,
|
|
20820
|
+
webviewContainer,
|
|
20821
|
+
messenger: this.messenger,
|
|
20822
|
+
messageParticipant: participant,
|
|
20823
|
+
identifier
|
|
20824
|
+
});
|
|
20825
|
+
}
|
|
20826
|
+
didCloseWebview(endpoint) {
|
|
20827
|
+
var _a;
|
|
20828
|
+
super.didCloseWebview(endpoint);
|
|
20829
|
+
try {
|
|
20830
|
+
this.languageClient.sendNotification(protocol_1.didCloseMessageType, (_a = endpoint.diagramIdentifier) === null || _a === void 0 ? void 0 : _a.clientId);
|
|
20831
|
+
} catch (err) {
|
|
20832
|
+
}
|
|
20833
|
+
}
|
|
20834
|
+
acceptFromLanguageServer(message) {
|
|
20835
|
+
if (this.endpoint) {
|
|
20836
|
+
this.endpoint.sendAction(message);
|
|
20837
|
+
}
|
|
20838
|
+
}
|
|
20839
|
+
};
|
|
20840
|
+
exports2.LspSprottyViewProvider = LspSprottyViewProvider2;
|
|
20841
|
+
}
|
|
20842
|
+
});
|
|
20843
|
+
|
|
18066
20844
|
// src/extension/main.ts
|
|
18067
20845
|
var main_exports = {};
|
|
18068
20846
|
__export(main_exports, {
|
|
@@ -18070,11 +20848,51 @@ __export(main_exports, {
|
|
|
18070
20848
|
deactivate: () => deactivate
|
|
18071
20849
|
});
|
|
18072
20850
|
module.exports = __toCommonJS(main_exports);
|
|
20851
|
+
var vscode = __toESM(require("vscode"), 1);
|
|
18073
20852
|
var path = __toESM(require("path"), 1);
|
|
18074
20853
|
var import_node = __toESM(require_node3(), 1);
|
|
20854
|
+
var import_sprotty_vscode = __toESM(require_lib5(), 1);
|
|
20855
|
+
var import_lsp_sprotty_view_provider = __toESM(require_lsp_sprotty_view_provider(), 1);
|
|
20856
|
+
var import_vscode_messenger = __toESM(require_lib2(), 1);
|
|
18075
20857
|
var client;
|
|
20858
|
+
var CustomLspSprottyViewProvider = class extends import_lsp_sprotty_view_provider.LspSprottyViewProvider {
|
|
20859
|
+
createWebview(container) {
|
|
20860
|
+
const webview = container.webview;
|
|
20861
|
+
const localResourceRoots = [(0, import_sprotty_vscode.createFileUri)(this.options.extensionUri.fsPath, "pack", "diagram")];
|
|
20862
|
+
webview.options = {
|
|
20863
|
+
enableScripts: true,
|
|
20864
|
+
localResourceRoots
|
|
20865
|
+
};
|
|
20866
|
+
const identifier = { clientId: "aurora", diagramType: "aurora", uri: "aurora" };
|
|
20867
|
+
webview.html = (0, import_sprotty_vscode.createWebviewHtml)(identifier, container, {
|
|
20868
|
+
scriptUri: (0, import_sprotty_vscode.createFileUri)(this.options.extensionUri.fsPath, "pack", "diagram", "main.js"),
|
|
20869
|
+
cssUri: (0, import_sprotty_vscode.createFileUri)(this.options.extensionUri.fsPath, "pack", "diagram", "main.css")
|
|
20870
|
+
});
|
|
20871
|
+
}
|
|
20872
|
+
};
|
|
18076
20873
|
function activate(context) {
|
|
20874
|
+
console.log("Hello Activation...");
|
|
18077
20875
|
client = startLanguageClient(context);
|
|
20876
|
+
context.subscriptions.push(
|
|
20877
|
+
vscode.commands.registerCommand("aurora.focus", () => {
|
|
20878
|
+
console.log("Aurora focus command executed");
|
|
20879
|
+
})
|
|
20880
|
+
);
|
|
20881
|
+
const webviewViewProvider = new CustomLspSprottyViewProvider({
|
|
20882
|
+
extensionUri: context.extensionUri,
|
|
20883
|
+
viewType: "aurora",
|
|
20884
|
+
languageClient: client,
|
|
20885
|
+
supportedFileExtensions: [".aurora"],
|
|
20886
|
+
openActiveEditor: true,
|
|
20887
|
+
messenger: new import_vscode_messenger.Messenger({ ignoreHiddenViews: false })
|
|
20888
|
+
});
|
|
20889
|
+
context.subscriptions.push(
|
|
20890
|
+
vscode.window.registerWebviewViewProvider("aurora", webviewViewProvider, {
|
|
20891
|
+
webviewOptions: { retainContextWhenHidden: true }
|
|
20892
|
+
})
|
|
20893
|
+
);
|
|
20894
|
+
(0, import_sprotty_vscode.registerDefaultCommands)(webviewViewProvider, context, { extensionPrefix: "aurora" });
|
|
20895
|
+
(0, import_sprotty_vscode.registerTextEditorSync)(webviewViewProvider, context);
|
|
18078
20896
|
}
|
|
18079
20897
|
function deactivate() {
|
|
18080
20898
|
if (client) {
|
|
@@ -18090,7 +20908,15 @@ function startLanguageClient(context) {
|
|
|
18090
20908
|
debug: { module: serverModule, transport: import_node.TransportKind.ipc, options: debugOptions }
|
|
18091
20909
|
};
|
|
18092
20910
|
const clientOptions = {
|
|
18093
|
-
documentSelector: [{ scheme: "
|
|
20911
|
+
documentSelector: [{ scheme: "file", language: "aurora" }],
|
|
20912
|
+
synchronize: {
|
|
20913
|
+
fileEvents: vscode.workspace.createFileSystemWatcher("**/*.aurora")
|
|
20914
|
+
},
|
|
20915
|
+
outputChannel: vscode.window.createOutputChannel("Aurora Language Server"),
|
|
20916
|
+
initializationFailedHandler: (error) => {
|
|
20917
|
+
console.error("Language server initialization failed:", error);
|
|
20918
|
+
return false;
|
|
20919
|
+
}
|
|
18094
20920
|
};
|
|
18095
20921
|
const client2 = new import_node.LanguageClient(
|
|
18096
20922
|
"aurora",
|
|
@@ -18098,7 +20924,17 @@ function startLanguageClient(context) {
|
|
|
18098
20924
|
serverOptions,
|
|
18099
20925
|
clientOptions
|
|
18100
20926
|
);
|
|
18101
|
-
client2.start()
|
|
20927
|
+
client2.start().catch((error) => {
|
|
20928
|
+
console.error("Failed to start language client:", error);
|
|
20929
|
+
vscode.window.showErrorMessage(`Failed to start Aurora language server: ${error.message}`);
|
|
20930
|
+
});
|
|
20931
|
+
context.subscriptions.push(
|
|
20932
|
+
client2.onDidChangeState((event) => {
|
|
20933
|
+
if (event.newState === import_node.State.Stopped) {
|
|
20934
|
+
console.log("Language server stopped");
|
|
20935
|
+
}
|
|
20936
|
+
})
|
|
20937
|
+
);
|
|
18102
20938
|
return client2;
|
|
18103
20939
|
}
|
|
18104
20940
|
// Annotate the CommonJS export names for ESM import in node:
|