@eclipse-glsp/client 2.1.0-next.295 → 2.1.0-next.297
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/css/ghost-element.css +25 -0
- package/css/glsp-sprotty.css +5 -0
- package/lib/base/args-feature.d.ts +2 -1
- package/lib/base/args-feature.d.ts.map +1 -1
- package/lib/base/args-feature.js +12 -2
- package/lib/base/args-feature.js.map +1 -1
- package/lib/base/command-stack.d.ts +22 -3
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +2 -2
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/default.module.d.ts +1 -1
- package/lib/base/default.module.d.ts.map +1 -1
- package/lib/base/default.module.js +2 -2
- package/lib/base/default.module.js.map +1 -1
- package/lib/base/feedback/css-feedback.d.ts +17 -0
- package/lib/base/feedback/css-feedback.d.ts.map +1 -1
- package/lib/base/feedback/css-feedback.js +4 -2
- package/lib/base/feedback/css-feedback.js.map +1 -1
- package/lib/base/selection-service.d.ts +18 -3
- package/lib/base/selection-service.d.ts.map +1 -1
- package/lib/base/selection-service.js +1 -1
- package/lib/base/selection-service.js.map +1 -1
- package/lib/default-modules.d.ts +1 -1
- package/lib/default-modules.d.ts.map +1 -1
- package/lib/default-modules.js +2 -0
- package/lib/default-modules.js.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette-module.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette-module.js +4 -2
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette-module.js.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.d.ts +16 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js +9 -10
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js.map +1 -1
- package/lib/features/bounds/bounds-module.d.ts.map +1 -1
- package/lib/features/bounds/bounds-module.js +4 -0
- package/lib/features/bounds/bounds-module.js.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +2 -2
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +7 -3
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/lib/features/bounds/local-bounds.d.ts +34 -0
- package/lib/features/bounds/local-bounds.d.ts.map +1 -0
- package/lib/features/bounds/local-bounds.js +99 -0
- package/lib/features/bounds/local-bounds.js.map +1 -0
- package/lib/features/bounds/set-bounds-feedback-command.d.ts +33 -0
- package/lib/features/bounds/set-bounds-feedback-command.d.ts.map +1 -0
- package/lib/features/bounds/set-bounds-feedback-command.js +74 -0
- package/lib/features/bounds/set-bounds-feedback-command.js.map +1 -0
- package/lib/features/change-bounds/model.d.ts +1 -1
- package/lib/features/change-bounds/model.d.ts.map +1 -1
- package/lib/features/change-bounds/model.js +0 -1
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/decoration/decoration-placer.d.ts +16 -1
- package/lib/features/decoration/decoration-placer.d.ts.map +1 -1
- package/lib/features/decoration/decoration-placer.js +3 -3
- package/lib/features/decoration/decoration-placer.js.map +1 -1
- package/lib/features/element-template/add-template-element.d.ts +39 -0
- package/lib/features/element-template/add-template-element.d.ts.map +1 -0
- package/lib/features/element-template/add-template-element.js +107 -0
- package/lib/features/element-template/add-template-element.js.map +1 -0
- package/lib/features/element-template/element-template-module.d.ts +18 -0
- package/lib/features/element-template/element-template-module.d.ts.map +1 -0
- package/lib/features/element-template/element-template-module.js +27 -0
- package/lib/features/element-template/element-template-module.js.map +1 -0
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts +38 -0
- package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts.map +1 -0
- package/lib/features/element-template/mouse-tracking-element-position-listener.js +102 -0
- package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -0
- package/lib/features/element-template/remove-template-element.d.ts +32 -0
- package/lib/features/element-template/remove-template-element.d.ts.map +1 -0
- package/lib/features/element-template/remove-template-element.js +66 -0
- package/lib/features/element-template/remove-template-element.js.map +1 -0
- package/lib/features/tool-palette/tool-palette-module.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette-module.js +2 -0
- package/lib/features/tool-palette/tool-palette-module.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +22 -4
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +35 -11
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +6 -5
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/change-bounds/view.d.ts +16 -1
- package/lib/features/tools/change-bounds/view.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/view.js +1 -1
- package/lib/features/tools/change-bounds/view.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-module.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-module.js +2 -1
- package/lib/features/tools/node-creation/node-creation-module.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +24 -3
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +41 -11
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/base/args-feature.ts +12 -2
- package/src/base/command-stack.ts +10 -5
- package/src/base/default.module.ts +2 -2
- package/src/base/feedback/css-feedback.ts +4 -1
- package/src/base/selection-service.ts +12 -6
- package/src/default-modules.ts +2 -0
- package/src/features/accessibility/keyboard-tool-palette/keyboard-tool-palette-module.ts +13 -3
- package/src/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.ts +15 -16
- package/src/features/bounds/bounds-module.ts +6 -0
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +11 -7
- package/src/features/bounds/local-bounds.ts +91 -0
- package/src/features/bounds/set-bounds-feedback-command.ts +70 -0
- package/src/features/change-bounds/model.ts +2 -3
- package/src/features/decoration/decoration-placer.ts +3 -3
- package/src/features/element-template/add-template-element.ts +109 -0
- package/src/features/element-template/element-template-module.ts +24 -0
- package/src/features/element-template/mouse-tracking-element-position-listener.ts +110 -0
- package/src/features/element-template/remove-template-element.ts +56 -0
- package/src/features/tool-palette/tool-palette-module.ts +3 -1
- package/src/features/tool-palette/tool-palette.ts +42 -14
- package/src/features/tools/change-bounds/change-bounds-tool.ts +12 -10
- package/src/features/tools/change-bounds/view.tsx +1 -1
- package/src/features/tools/node-creation/node-creation-module.ts +9 -5
- package/src/features/tools/node-creation/node-creation-tool.ts +51 -13
- package/src/index.ts +4 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.templateToSchema = exports.AddTemplateElementsFeedbackCommand = exports.getTemplateElementId = exports.AddTemplateElementsAction = void 0;
|
|
31
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
32
|
+
const inversify_1 = require("inversify");
|
|
33
|
+
const action_dispatcher_1 = require("../../base/action-dispatcher");
|
|
34
|
+
const feedback_command_1 = require("../../base/feedback/feedback-command");
|
|
35
|
+
const gmodel_util_1 = require("../../utils/gmodel-util");
|
|
36
|
+
const local_bounds_1 = require("../bounds/local-bounds");
|
|
37
|
+
var AddTemplateElementsAction;
|
|
38
|
+
(function (AddTemplateElementsAction) {
|
|
39
|
+
AddTemplateElementsAction.KIND = 'addTemplateElements';
|
|
40
|
+
function create(options) {
|
|
41
|
+
return Object.assign({ kind: AddTemplateElementsAction.KIND }, options);
|
|
42
|
+
}
|
|
43
|
+
AddTemplateElementsAction.create = create;
|
|
44
|
+
})(AddTemplateElementsAction || (exports.AddTemplateElementsAction = AddTemplateElementsAction = {}));
|
|
45
|
+
function getTemplateElementId(template) {
|
|
46
|
+
return typeof template === 'string' ? `${template}_feedback` : template.id;
|
|
47
|
+
}
|
|
48
|
+
exports.getTemplateElementId = getTemplateElementId;
|
|
49
|
+
let AddTemplateElementsFeedbackCommand = class AddTemplateElementsFeedbackCommand extends feedback_command_1.FeedbackCommand {
|
|
50
|
+
constructor(action) {
|
|
51
|
+
super();
|
|
52
|
+
this.action = action;
|
|
53
|
+
}
|
|
54
|
+
execute(context) {
|
|
55
|
+
this.action.templates
|
|
56
|
+
.map(template => templateToSchema(template, context))
|
|
57
|
+
.filter(gmodel_util_1.isNotUndefined)
|
|
58
|
+
.map(schema => context.modelFactory.createElement(schema))
|
|
59
|
+
.map(element => this.applyRootCssClasses(element, this.action.addClasses, this.action.removeClasses))
|
|
60
|
+
.forEach(templateElement => context.root.add(templateElement));
|
|
61
|
+
return local_bounds_1.LocalRequestBoundsAction.fromCommand(context, this.actionDispatcher, this.action);
|
|
62
|
+
}
|
|
63
|
+
applyRootCssClasses(element, addClasses, removeClasses) {
|
|
64
|
+
element.cssClasses = modifyCssClasses(element.cssClasses, addClasses, removeClasses);
|
|
65
|
+
return element;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.AddTemplateElementsFeedbackCommand = AddTemplateElementsFeedbackCommand;
|
|
69
|
+
AddTemplateElementsFeedbackCommand.KIND = AddTemplateElementsAction.KIND;
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, inversify_1.inject)(sprotty_1.TYPES.IActionDispatcher),
|
|
72
|
+
__metadata("design:type", action_dispatcher_1.GLSPActionDispatcher)
|
|
73
|
+
], AddTemplateElementsFeedbackCommand.prototype, "actionDispatcher", void 0);
|
|
74
|
+
exports.AddTemplateElementsFeedbackCommand = AddTemplateElementsFeedbackCommand = __decorate([
|
|
75
|
+
(0, inversify_1.injectable)(),
|
|
76
|
+
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
77
|
+
__metadata("design:paramtypes", [Object])
|
|
78
|
+
], AddTemplateElementsFeedbackCommand);
|
|
79
|
+
function templateToSchema(template, context) {
|
|
80
|
+
if (typeof template === 'string') {
|
|
81
|
+
const element = context.root.index.getById(template);
|
|
82
|
+
const schema = element ? context.modelFactory.createSchema(element) : undefined;
|
|
83
|
+
if (schema) {
|
|
84
|
+
adaptSchemaIds(schema);
|
|
85
|
+
}
|
|
86
|
+
return schema;
|
|
87
|
+
}
|
|
88
|
+
return template;
|
|
89
|
+
}
|
|
90
|
+
exports.templateToSchema = templateToSchema;
|
|
91
|
+
function adaptSchemaIds(schema) {
|
|
92
|
+
var _a;
|
|
93
|
+
schema.id = getTemplateElementId(schema.id);
|
|
94
|
+
(_a = schema.children) === null || _a === void 0 ? void 0 : _a.forEach(child => adaptSchemaIds(child));
|
|
95
|
+
return schema;
|
|
96
|
+
}
|
|
97
|
+
function modifyCssClasses(source, toAdd, toRemove) {
|
|
98
|
+
const classes = source !== null && source !== void 0 ? source : [];
|
|
99
|
+
if (toAdd) {
|
|
100
|
+
(0, sprotty_1.distinctAdd)(classes, ...toAdd);
|
|
101
|
+
}
|
|
102
|
+
if (toRemove) {
|
|
103
|
+
(0, sprotty_1.remove)(classes, ...toRemove);
|
|
104
|
+
}
|
|
105
|
+
return classes;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=add-template-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-template-element.js","sourceRoot":"","sources":["../../../src/features/element-template/add-template-element.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;AAElF,mDAU+B;AAC/B,yCAA+C;AAC/C,oEAAoE;AACpE,2EAAuE;AACvE,yDAAyD;AACzD,yDAAkE;AASlE,IAAiB,yBAAyB,CASzC;AATD,WAAiB,yBAAyB;IACzB,8BAAI,GAAG,qBAAqB,CAAC;IAE1C,SAAgB,MAAM,CA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AI,KAAK,EAAE;QACP,IAAA,qBAAW,EAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC;KAClC;IACD,IAAI,QAAQ,EAAE;QACV,IAAA,gBAAM,EAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC;KAChC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { FeatureModule } from '@eclipse-glsp/sprotty';
|
|
17
|
+
export declare const elementTemplateModule: FeatureModule;
|
|
18
|
+
//# sourceMappingURL=element-template-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-template-module.d.ts","sourceRoot":"","sources":["../../../src/features/element-template/element-template-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAoB,MAAM,uBAAuB,CAAC;AAIxE,eAAO,MAAM,qBAAqB,eAIhC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.elementTemplateModule = void 0;
|
|
4
|
+
/********************************************************************************
|
|
5
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made available under the
|
|
8
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
*
|
|
11
|
+
* This Source Code may also be made available under the following Secondary
|
|
12
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
* with the GNU Classpath Exception which is available at
|
|
15
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
*
|
|
17
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
18
|
+
********************************************************************************/
|
|
19
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
20
|
+
const add_template_element_1 = require("./add-template-element");
|
|
21
|
+
const remove_template_element_1 = require("./remove-template-element");
|
|
22
|
+
exports.elementTemplateModule = new sprotty_1.FeatureModule((bind, unbind, isBound, rebind) => {
|
|
23
|
+
const context = { bind, unbind, isBound, rebind };
|
|
24
|
+
(0, sprotty_1.configureCommand)(context, add_template_element_1.AddTemplateElementsFeedbackCommand);
|
|
25
|
+
(0, sprotty_1.configureCommand)(context, remove_template_element_1.RemoveTemplateElementsFeedbackCommand);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=element-template-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-template-module.js","sourceRoot":"","sources":["../../../src/features/element-template/element-template-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAAwE;AACxE,iEAA4E;AAC5E,uEAAkF;AAErE,QAAA,qBAAqB,GAAG,IAAI,uBAAa,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACrF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,IAAA,0BAAgB,EAAC,OAAO,EAAE,yDAAkC,CAAC,CAAC;IAC9D,IAAA,0BAAgB,EAAC,OAAO,EAAE,+DAAqC,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { Action, Disposable, GModelElement, ISnapper, Point } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { DragAwareMouseListener } from '../../base/drag-aware-mouse-listener';
|
|
18
|
+
import { IFeedbackEmitter } from '../../base/feedback/feedback-action-dispatcher';
|
|
19
|
+
import { Tool } from '../../base/tool-manager/tool';
|
|
20
|
+
import { IMovementRestrictor } from '../change-bounds/movement-restrictor';
|
|
21
|
+
export interface PositioningTool extends Tool {
|
|
22
|
+
readonly snapper?: ISnapper;
|
|
23
|
+
readonly movementRestrictor?: IMovementRestrictor;
|
|
24
|
+
registerFeedback(feedbackActions: Action[], feedbackEmitter?: IFeedbackEmitter, cleanupActions?: Action[]): Disposable;
|
|
25
|
+
deregisterFeedback(feedbackEmitter?: IFeedbackEmitter, cleanupActions?: Action[]): void;
|
|
26
|
+
}
|
|
27
|
+
export declare class MouseTrackingElementPositionListener extends DragAwareMouseListener {
|
|
28
|
+
protected elementId: string;
|
|
29
|
+
protected tool: PositioningTool;
|
|
30
|
+
protected cursorPosition: 'top-left' | 'middle';
|
|
31
|
+
element?: GModelElement;
|
|
32
|
+
currentPosition?: Point;
|
|
33
|
+
constructor(elementId: string, tool: PositioningTool, cursorPosition?: 'top-left' | 'middle');
|
|
34
|
+
mouseMove(target: GModelElement, event: MouseEvent): Action[];
|
|
35
|
+
protected snap(position: Point, element: GModelElement, isSnap?: boolean): Point;
|
|
36
|
+
protected validateMove(startPosition: Point, toPosition: Point, element: GModelElement, isFinished: boolean): Point;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=mouse-tracking-element-position-listener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse-tracking-element-position-listener.d.ts","sourceRoot":"","sources":["../../../src/features/element-template/mouse-tracking-element-position-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAc,KAAK,EAA6B,MAAM,uBAAuB,CAAC;AAElI,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EACH,mBAAmB,EAGtB,MAAM,sCAAsC,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,IAAI;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IAElD,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACvH,kBAAkB,CAAC,eAAe,CAAC,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC3F;AAED,qBACa,oCAAqC,SAAQ,sBAAsB;IAKxE,SAAS,CAAC,SAAS,EAAE,MAAM;IAC3B,SAAS,CAAC,IAAI,EAAE,eAAe;IAC/B,SAAS,CAAC,cAAc,EAAE,UAAU,GAAG,QAAQ;IANnD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,eAAe,CAAC,EAAE,KAAK,CAAC;gBAGV,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,eAAe,EACrB,cAAc,GAAE,UAAU,GAAG,QAAqB;IAKvD,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IAkCtE,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAO,GAAG,KAAK;IAQ7E,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,GAAG,KAAK;CAiBtH"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.MouseTrackingElementPositionListener = void 0;
|
|
28
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
|
+
const drag_aware_mouse_listener_1 = require("../../base/drag-aware-mouse-listener");
|
|
31
|
+
const css_feedback_1 = require("../../base/feedback/css-feedback");
|
|
32
|
+
const viewpoint_util_1 = require("../../utils/viewpoint-util");
|
|
33
|
+
const movement_restrictor_1 = require("../change-bounds/movement-restrictor");
|
|
34
|
+
let MouseTrackingElementPositionListener = class MouseTrackingElementPositionListener extends drag_aware_mouse_listener_1.DragAwareMouseListener {
|
|
35
|
+
constructor(elementId, tool, cursorPosition = 'top-left') {
|
|
36
|
+
super();
|
|
37
|
+
this.elementId = elementId;
|
|
38
|
+
this.tool = tool;
|
|
39
|
+
this.cursorPosition = cursorPosition;
|
|
40
|
+
}
|
|
41
|
+
mouseMove(target, event) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
super.mouseMove(target, event);
|
|
44
|
+
const element = target.root.index.getById(this.elementId);
|
|
45
|
+
this.element = element;
|
|
46
|
+
if (!element) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
let newPosition = (0, viewpoint_util_1.getAbsolutePosition)(target, event);
|
|
50
|
+
if (this.cursorPosition === 'middle' && (0, sprotty_1.isBoundsAware)(element)) {
|
|
51
|
+
newPosition = sprotty_1.Point.subtract(newPosition, { x: element.bounds.width / 2, y: element.bounds.height / 2 });
|
|
52
|
+
}
|
|
53
|
+
newPosition = this.snap(newPosition, element);
|
|
54
|
+
const finished = false;
|
|
55
|
+
if ((0, sprotty_1.isMoveable)(element)) {
|
|
56
|
+
newPosition = this.validateMove((_a = this.currentPosition) !== null && _a !== void 0 ? _a : newPosition, newPosition, element, finished);
|
|
57
|
+
}
|
|
58
|
+
this.currentPosition = newPosition;
|
|
59
|
+
const moveGhostElement = sprotty_1.MoveAction.create([
|
|
60
|
+
{
|
|
61
|
+
elementId: element.id,
|
|
62
|
+
toPosition: newPosition
|
|
63
|
+
}
|
|
64
|
+
], { animate: false, finished });
|
|
65
|
+
this.tool.registerFeedback([moveGhostElement], this);
|
|
66
|
+
return ((_b = element.cssClasses) === null || _b === void 0 ? void 0 : _b.includes(css_feedback_1.CSS_HIDDEN))
|
|
67
|
+
? [css_feedback_1.ModifyCSSFeedbackAction.create({ elements: [element.id], remove: [css_feedback_1.CSS_HIDDEN] })]
|
|
68
|
+
: [];
|
|
69
|
+
}
|
|
70
|
+
snap(position, element, isSnap = true) {
|
|
71
|
+
if (isSnap && this.tool.snapper) {
|
|
72
|
+
return this.tool.snapper.snap(position, element);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return position;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
validateMove(startPosition, toPosition, element, isFinished) {
|
|
79
|
+
let newPosition = toPosition;
|
|
80
|
+
if (this.tool.movementRestrictor) {
|
|
81
|
+
const valid = this.tool.movementRestrictor.validate(element, toPosition);
|
|
82
|
+
let action;
|
|
83
|
+
if (!valid) {
|
|
84
|
+
action = (0, movement_restrictor_1.createMovementRestrictionFeedback)(element, this.tool.movementRestrictor);
|
|
85
|
+
if (isFinished) {
|
|
86
|
+
newPosition = startPosition;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
action = (0, movement_restrictor_1.removeMovementRestrictionFeedback)(element, this.tool.movementRestrictor);
|
|
91
|
+
}
|
|
92
|
+
this.tool.registerFeedback([action], this, [(0, movement_restrictor_1.removeMovementRestrictionFeedback)(element, this.tool.movementRestrictor)]);
|
|
93
|
+
}
|
|
94
|
+
return newPosition;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.MouseTrackingElementPositionListener = MouseTrackingElementPositionListener;
|
|
98
|
+
exports.MouseTrackingElementPositionListener = MouseTrackingElementPositionListener = __decorate([
|
|
99
|
+
(0, inversify_1.injectable)(),
|
|
100
|
+
__metadata("design:paramtypes", [String, Object, String])
|
|
101
|
+
], MouseTrackingElementPositionListener);
|
|
102
|
+
//# sourceMappingURL=mouse-tracking-element-position-listener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse-tracking-element-position-listener.js","sourceRoot":"","sources":["../../../src/features/element-template/mouse-tracking-element-position-listener.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,mDAAkI;AAClI,yCAAuC;AACvC,oFAA8E;AAC9E,mEAAuF;AAGvF,+DAAiE;AACjE,8EAI8C;AAWvC,IAAM,oCAAoC,GAA1C,MAAM,oCAAqC,SAAQ,kDAAsB;IAI5E,YACc,SAAiB,EACjB,IAAqB,EACrB,iBAAwC,UAAU;QAE5D,KAAK,EAAE,CAAC;QAJE,cAAS,GAAT,SAAS,CAAQ;QACjB,SAAI,GAAJ,IAAI,CAAiB;QACrB,mBAAc,GAAd,cAAc,CAAoC;IAGhE,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AAM,CAAC,EAAE,IAAI,EAAE,CAAC,IAAA,uDAAiC,EAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;SAC1H;QACD,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ,CAAA;AAvEY,oFAAoC;+CAApC,oCAAoC;IADhD,IAAA,sBAAU,GAAE;;GACA,oCAAoC,CAuEhD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { Action, CommandExecutionContext, CommandReturn, ElementTemplate } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { FeedbackCommand } from '../../base/feedback/feedback-command';
|
|
18
|
+
export interface RemoveTemplateElementsAction extends Action {
|
|
19
|
+
kind: typeof RemoveTemplateElementsAction.KIND;
|
|
20
|
+
templates: ElementTemplate[];
|
|
21
|
+
}
|
|
22
|
+
export declare namespace RemoveTemplateElementsAction {
|
|
23
|
+
const KIND = "removeTemplateElements";
|
|
24
|
+
function create(options: Omit<RemoveTemplateElementsAction, 'kind'>): RemoveTemplateElementsAction;
|
|
25
|
+
}
|
|
26
|
+
export declare class RemoveTemplateElementsFeedbackCommand extends FeedbackCommand {
|
|
27
|
+
readonly action: RemoveTemplateElementsAction;
|
|
28
|
+
static readonly KIND = "removeTemplateElements";
|
|
29
|
+
constructor(action: RemoveTemplateElementsAction);
|
|
30
|
+
execute(context: CommandExecutionContext): CommandReturn;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=remove-template-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-template-element.d.ts","sourceRoot":"","sources":["../../../src/features/element-template/remove-template-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,aAAa,EAAE,eAAe,EAAwB,MAAM,uBAAuB,CAAC;AAE9H,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,MAAM,WAAW,4BAA6B,SAAQ,MAAM;IACxD,IAAI,EAAE,OAAO,4BAA4B,CAAC,IAAI,CAAC;IAC/C,SAAS,EAAE,eAAe,EAAE,CAAC;CAChC;AAED,yBAAiB,4BAA4B,CAAC;IACnC,MAAM,IAAI,2BAA2B,CAAC;IAE7C,SAAgB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,4BAA4B,EAAE,MAAM,CAAC,GAAG,4BAA4B,CAKxG;CACJ;AAED,qBACa,qCAAsC,SAAQ,eAAe;IAGpC,QAAQ,CAAC,MAAM,EAAE,4BAA4B;IAF/E,MAAM,CAAC,QAAQ,CAAC,IAAI,4BAAqC;gBAEd,MAAM,EAAE,4BAA4B;IAI/E,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa;CAU3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.RemoveTemplateElementsFeedbackCommand = exports.RemoveTemplateElementsAction = void 0;
|
|
31
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
32
|
+
const inversify_1 = require("inversify");
|
|
33
|
+
const feedback_command_1 = require("../../base/feedback/feedback-command");
|
|
34
|
+
const add_template_element_1 = require("./add-template-element");
|
|
35
|
+
var RemoveTemplateElementsAction;
|
|
36
|
+
(function (RemoveTemplateElementsAction) {
|
|
37
|
+
RemoveTemplateElementsAction.KIND = 'removeTemplateElements';
|
|
38
|
+
function create(options) {
|
|
39
|
+
return Object.assign({ kind: RemoveTemplateElementsAction.KIND }, options);
|
|
40
|
+
}
|
|
41
|
+
RemoveTemplateElementsAction.create = create;
|
|
42
|
+
})(RemoveTemplateElementsAction || (exports.RemoveTemplateElementsAction = RemoveTemplateElementsAction = {}));
|
|
43
|
+
let RemoveTemplateElementsFeedbackCommand = class RemoveTemplateElementsFeedbackCommand extends feedback_command_1.FeedbackCommand {
|
|
44
|
+
constructor(action) {
|
|
45
|
+
super();
|
|
46
|
+
this.action = action;
|
|
47
|
+
}
|
|
48
|
+
execute(context) {
|
|
49
|
+
const index = context.root.index;
|
|
50
|
+
for (const template of this.action.templates) {
|
|
51
|
+
const element = index.getById((0, add_template_element_1.getTemplateElementId)(template));
|
|
52
|
+
if (element && element instanceof sprotty_1.GChildElement) {
|
|
53
|
+
element.parent.remove(element);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return context.root;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.RemoveTemplateElementsFeedbackCommand = RemoveTemplateElementsFeedbackCommand;
|
|
60
|
+
RemoveTemplateElementsFeedbackCommand.KIND = RemoveTemplateElementsAction.KIND;
|
|
61
|
+
exports.RemoveTemplateElementsFeedbackCommand = RemoveTemplateElementsFeedbackCommand = __decorate([
|
|
62
|
+
(0, inversify_1.injectable)(),
|
|
63
|
+
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
64
|
+
__metadata("design:paramtypes", [Object])
|
|
65
|
+
], RemoveTemplateElementsFeedbackCommand);
|
|
66
|
+
//# sourceMappingURL=remove-template-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-template-element.js","sourceRoot":"","sources":["../../../src/features/element-template/remove-template-element.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;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FAckF;AAClF,OAAO,EAAyC,aAAa,
|
|
1
|
+
{"version":3,"file":"tool-palette-module.d.ts","sourceRoot":"","sources":["../../../src/features/tool-palette/tool-palette-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAyC,aAAa,EAA4C,MAAM,uBAAuB,CAAC;AACvI,OAAO,+BAA+B,CAAC;AAIvC,eAAO,MAAM,iBAAiB,eAM5B,CAAC"}
|
|
@@ -24,5 +24,7 @@ exports.toolPaletteModule = new sprotty_1.FeatureModule((bind, _unbind, isBound,
|
|
|
24
24
|
(0, sprotty_1.bindAsService)(bind, sprotty_1.TYPES.IUIExtension, tool_palette_1.ToolPalette);
|
|
25
25
|
bind(sprotty_1.TYPES.IDiagramStartup).toService(tool_palette_1.ToolPalette);
|
|
26
26
|
(0, sprotty_1.configureActionHandler)({ bind, isBound }, tool_1.EnableDefaultToolsAction.KIND, tool_palette_1.ToolPalette);
|
|
27
|
+
(0, sprotty_1.configureActionHandler)({ bind, isBound }, sprotty_1.UpdateModelAction.KIND, tool_palette_1.ToolPalette);
|
|
28
|
+
(0, sprotty_1.configureActionHandler)({ bind, isBound }, sprotty_1.SetModelAction.KIND, tool_palette_1.ToolPalette);
|
|
27
29
|
});
|
|
28
30
|
//# sourceMappingURL=tool-palette-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-palette-module.js","sourceRoot":"","sources":["../../../src/features/tool-palette/tool-palette-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"tool-palette-module.js","sourceRoot":"","sources":["../../../src/features/tool-palette/tool-palette-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAAuI;AACvI,yCAAuC;AACvC,uDAAwE;AACxE,iDAA6C;AAEhC,QAAA,iBAAiB,GAAG,IAAI,uBAAa,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACnF,IAAA,uBAAa,EAAC,IAAI,EAAE,eAAK,CAAC,YAAY,EAAE,0BAAW,CAAC,CAAC;IACrD,IAAI,CAAC,eAAK,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,0BAAW,CAAC,CAAC;IACnD,IAAA,gCAAsB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,+BAAwB,CAAC,IAAI,EAAE,0BAAW,CAAC,CAAC;IACtF,IAAA,gCAAsB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,2BAAiB,CAAC,IAAI,EAAE,0BAAW,CAAC,CAAC;IAC/E,IAAA,gCAAsB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,wBAAc,CAAC,IAAI,EAAE,0BAAW,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { AbstractUIExtension, Action, GModelRoot, IActionHandler, ICommand, PaletteItem } from '@eclipse-glsp/sprotty';
|
|
2
17
|
import { GLSPActionDispatcher } from '../../base/action-dispatcher';
|
|
3
18
|
import { EditorContextService, IEditModeListener } from '../../base/editor-context-service';
|
|
4
19
|
import { FocusTracker } from '../../base/focus/focus-tracker';
|
|
5
20
|
import { IDiagramStartup } from '../../base/model/diagram-loader';
|
|
6
|
-
import { EnableDefaultToolsAction } from '../../base/tool-manager/tool';
|
|
7
21
|
export interface EnableToolPaletteAction extends Action {
|
|
8
22
|
kind: typeof EnableToolPaletteAction.KIND;
|
|
9
23
|
}
|
|
@@ -19,6 +33,7 @@ export declare class ToolPalette extends AbstractUIExtension implements IActionH
|
|
|
19
33
|
protected focusTracker: FocusTracker;
|
|
20
34
|
protected paletteItems: PaletteItem[];
|
|
21
35
|
protected paletteItemsCopy: PaletteItem[];
|
|
36
|
+
protected dynamic: boolean;
|
|
22
37
|
protected bodyDiv?: HTMLElement;
|
|
23
38
|
protected lastActiveButton?: HTMLElement;
|
|
24
39
|
protected defaultToolsButton: HTMLElement;
|
|
@@ -47,13 +62,16 @@ export declare class ToolPalette extends AbstractUIExtension implements IActionH
|
|
|
47
62
|
protected onClickCreateToolButton(button: HTMLElement, item: PaletteItem): (_ev: MouseEvent) => void;
|
|
48
63
|
protected onClickStaticToolButton(button: HTMLElement, toolId?: string): (_ev: MouseEvent) => void;
|
|
49
64
|
changeActiveButton(button?: HTMLElement): void;
|
|
50
|
-
handle(action:
|
|
65
|
+
handle(action: Action): ICommand | Action | void;
|
|
51
66
|
editModeChanged(_newValue: string, _oldValue: string): void;
|
|
52
67
|
protected clearOnEscape(event: KeyboardEvent): void;
|
|
53
68
|
protected clearToolOnEscape(event: KeyboardEvent): void;
|
|
54
|
-
protected handleSetContextActions(action: SetContextActions): void;
|
|
55
69
|
protected requestFilterUpdate(filter: string): void;
|
|
56
70
|
preRequestModel(): Promise<void>;
|
|
71
|
+
postRequestModel(): Promise<void>;
|
|
72
|
+
protected setPaletteItems(): Promise<void>;
|
|
73
|
+
protected hasDynamicAction(item: PaletteItem): boolean;
|
|
74
|
+
protected reloadPaletteBody(): Promise<void>;
|
|
57
75
|
}
|
|
58
76
|
export declare function compare(a: PaletteItem, b: PaletteItem): number;
|
|
59
77
|
export declare function createIcon(codiconId: string): HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-palette.d.ts","sourceRoot":"","sources":["../../../src/features/tool-palette/tool-palette.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-palette.d.ts","sourceRoot":"","sources":["../../../src/features/tool-palette/tool-palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,mBAAmB,EACnB,MAAM,EACN,UAAU,EACV,cAAc,EACd,QAAQ,EAER,WAAW,EAUd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAWlE,MAAM,WAAW,uBAAwB,SAAQ,MAAM;IACnD,IAAI,EAAE,OAAO,uBAAuB,CAAC,IAAI,CAAC;CAC7C;AAED,yBAAiB,uBAAuB,CAAC;IAC9B,MAAM,IAAI,sBAAsB,CAAC;IAExC,SAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,uBAAuB,CAEjE;IAED,SAAgB,MAAM,IAAI,uBAAuB,CAEhD;CACJ;AACD,qBACa,WAAY,SAAQ,mBAAoB,YAAW,cAAc,EAAE,iBAAiB,EAAE,eAAe;IAC9G,MAAM,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IAGpC,SAAS,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;IAGjD,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAG9C,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAErC,SAAS,CAAC,YAAY,EAA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iconClass = exports.changeCSSClass = exports.createToolGroup =
|
|
|
26
26
|
*
|
|
27
27
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
28
28
|
********************************************************************************/
|
|
29
|
-
const inversify_1 = require("inversify");
|
|
30
29
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
30
|
+
const inversify_1 = require("inversify");
|
|
31
31
|
const action_dispatcher_1 = require("../../base/action-dispatcher");
|
|
32
32
|
const editor_context_service_1 = require("../../base/editor-context-service");
|
|
33
33
|
const focus_tracker_1 = require("../../base/focus/focus-tracker");
|
|
@@ -55,6 +55,7 @@ let ToolPalette = ToolPalette_1 = class ToolPalette extends sprotty_1.AbstractUI
|
|
|
55
55
|
constructor() {
|
|
56
56
|
super(...arguments);
|
|
57
57
|
this.paletteItemsCopy = [];
|
|
58
|
+
this.dynamic = false;
|
|
58
59
|
}
|
|
59
60
|
id() {
|
|
60
61
|
return ToolPalette_1.ID;
|
|
@@ -289,9 +290,14 @@ let ToolPalette = ToolPalette_1 = class ToolPalette extends sprotty_1.AbstractUI
|
|
|
289
290
|
handle(action) {
|
|
290
291
|
var _a;
|
|
291
292
|
this.changeActiveButton();
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
if (sprotty_1.UpdateModelAction.is(action) || sprotty_1.SetModelAction.is(action)) {
|
|
294
|
+
this.reloadPaletteBody();
|
|
295
|
+
}
|
|
296
|
+
else if (tool_1.EnableDefaultToolsAction.is(action)) {
|
|
297
|
+
if (this.focusTracker.hasFocus) {
|
|
298
|
+
// if focus was deliberately taken do not restore focus to the palette
|
|
299
|
+
(_a = this.focusTracker.diagramElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
300
|
+
}
|
|
295
301
|
}
|
|
296
302
|
}
|
|
297
303
|
editModeChanged(_newValue, _oldValue) {
|
|
@@ -308,10 +314,6 @@ let ToolPalette = ToolPalette_1 = class ToolPalette extends sprotty_1.AbstractUI
|
|
|
308
314
|
this.actionDispatcher.dispatch(tool_1.EnableDefaultToolsAction.create());
|
|
309
315
|
}
|
|
310
316
|
}
|
|
311
|
-
handleSetContextActions(action) {
|
|
312
|
-
this.paletteItems = action.actions.map(e => e);
|
|
313
|
-
this.createBody();
|
|
314
|
-
}
|
|
315
317
|
requestFilterUpdate(filter) {
|
|
316
318
|
// Initialize the copy if it's empty
|
|
317
319
|
if (this.paletteItemsCopy.length === 0) {
|
|
@@ -340,6 +342,15 @@ let ToolPalette = ToolPalette_1 = class ToolPalette extends sprotty_1.AbstractUI
|
|
|
340
342
|
this.createBody();
|
|
341
343
|
}
|
|
342
344
|
async preRequestModel() {
|
|
345
|
+
await this.setPaletteItems();
|
|
346
|
+
if (!this.editorContext.isReadonly) {
|
|
347
|
+
this.show(this.editorContext.modelRoot);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async postRequestModel() {
|
|
351
|
+
this.reloadPaletteBody();
|
|
352
|
+
}
|
|
353
|
+
async setPaletteItems() {
|
|
343
354
|
const requestAction = sprotty_1.RequestContextActions.create({
|
|
344
355
|
contextId: ToolPalette_1.ID,
|
|
345
356
|
editorContext: {
|
|
@@ -347,9 +358,22 @@ let ToolPalette = ToolPalette_1 = class ToolPalette extends sprotty_1.AbstractUI
|
|
|
347
358
|
}
|
|
348
359
|
});
|
|
349
360
|
const response = await this.actionDispatcher.request(requestAction);
|
|
350
|
-
this.paletteItems = response.actions.map(
|
|
351
|
-
|
|
352
|
-
|
|
361
|
+
this.paletteItems = response.actions.map(action => action);
|
|
362
|
+
this.dynamic = this.paletteItems.some(item => this.hasDynamicAction(item));
|
|
363
|
+
}
|
|
364
|
+
hasDynamicAction(item) {
|
|
365
|
+
var _a;
|
|
366
|
+
const dynamic = !!item.actions.find(action => { var _a; return sprotty_1.TriggerNodeCreationAction.is(action) && ((_a = action.ghostElement) === null || _a === void 0 ? void 0 : _a.dynamic); });
|
|
367
|
+
if (dynamic) {
|
|
368
|
+
return dynamic;
|
|
369
|
+
}
|
|
370
|
+
return ((_a = item.children) === null || _a === void 0 ? void 0 : _a.some(child => this.hasDynamicAction(child))) || false;
|
|
371
|
+
}
|
|
372
|
+
async reloadPaletteBody() {
|
|
373
|
+
if (this.dynamic) {
|
|
374
|
+
await this.setPaletteItems();
|
|
375
|
+
this.paletteItemsCopy = [];
|
|
376
|
+
this.requestFilterUpdate(this.searchField.value);
|
|
353
377
|
}
|
|
354
378
|
}
|
|
355
379
|
};
|