@eclipse-glsp/graph 0.9.0-next.0193b16.17
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/LICENSE +642 -0
- package/README.md +8 -0
- package/lib/default-types.d.ts +3 -0
- package/lib/default-types.d.ts.map +1 -0
- package/lib/default-types.js +50 -0
- package/lib/default-types.js.map +1 -0
- package/lib/galignable.d.ts +28 -0
- package/lib/galignable.d.ts.map +1 -0
- package/lib/galignable.js +23 -0
- package/lib/galignable.js.map +1 -0
- package/lib/gbound-aware.d.ts +30 -0
- package/lib/gbound-aware.d.ts.map +1 -0
- package/lib/gbound-aware.js +34 -0
- package/lib/gbound-aware.js.map +1 -0
- package/lib/gbutton.d.ts +11 -0
- package/lib/gbutton.d.ts.map +1 -0
- package/lib/gbutton.js +39 -0
- package/lib/gbutton.js.map +1 -0
- package/lib/gcompartment.d.ts +34 -0
- package/lib/gcompartment.d.ts.map +1 -0
- package/lib/gcompartment.js +49 -0
- package/lib/gcompartment.js.map +1 -0
- package/lib/gedge-layoutable.d.ts +34 -0
- package/lib/gedge-layoutable.d.ts.map +1 -0
- package/lib/gedge-layoutable.js +20 -0
- package/lib/gedge-layoutable.js.map +1 -0
- package/lib/gedge.d.ts +40 -0
- package/lib/gedge.d.ts.map +1 -0
- package/lib/gedge.js +74 -0
- package/lib/gedge.js.map +1 -0
- package/lib/ggraph.d.ts +38 -0
- package/lib/ggraph.d.ts.map +1 -0
- package/lib/ggraph.js +51 -0
- package/lib/ggraph.js.map +1 -0
- package/lib/gissue-marker.d.ts +17 -0
- package/lib/gissue-marker.d.ts.map +1 -0
- package/lib/gissue-marker.js +48 -0
- package/lib/gissue-marker.js.map +1 -0
- package/lib/glabel.d.ts +36 -0
- package/lib/glabel.d.ts.map +1 -0
- package/lib/glabel.js +51 -0
- package/lib/glabel.js.map +1 -0
- package/lib/glayout-container.d.ts +27 -0
- package/lib/glayout-container.d.ts.map +1 -0
- package/lib/glayout-container.js +17 -0
- package/lib/glayout-container.js.map +1 -0
- package/lib/glayoutable.d.ts +29 -0
- package/lib/glayoutable.d.ts.map +1 -0
- package/lib/glayoutable.js +39 -0
- package/lib/glayoutable.js.map +1 -0
- package/lib/gmodel-element.d.ts +106 -0
- package/lib/gmodel-element.d.ts.map +1 -0
- package/lib/gmodel-element.js +165 -0
- package/lib/gmodel-element.js.map +1 -0
- package/lib/gmodel-util.d.ts +36 -0
- package/lib/gmodel-util.d.ts.map +1 -0
- package/lib/gmodel-util.js +55 -0
- package/lib/gmodel-util.js.map +1 -0
- package/lib/gnode.d.ts +12 -0
- package/lib/gnode.d.ts.map +1 -0
- package/lib/gnode.js +41 -0
- package/lib/gnode.js.map +1 -0
- package/lib/gport.d.ts +21 -0
- package/lib/gport.d.ts.map +1 -0
- package/lib/gport.js +31 -0
- package/lib/gport.js.map +1 -0
- package/lib/gpre-rendered-element.d.ts +31 -0
- package/lib/gpre-rendered-element.d.ts.map +1 -0
- package/lib/gpre-rendered-element.js +41 -0
- package/lib/gpre-rendered-element.js.map +1 -0
- package/lib/gshape-element.d.ts +36 -0
- package/lib/gshape-element.d.ts.map +1 -0
- package/lib/gshape-element.js +32 -0
- package/lib/gshape-element.js.map +1 -0
- package/lib/index.d.ts +34 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +46 -0
- package/lib/index.js.map +1 -0
- package/package.json +61 -0
- package/src/default-types.ts +48 -0
- package/src/galignable.ts +42 -0
- package/src/gbound-aware.ts +53 -0
- package/src/gbutton.ts +34 -0
- package/src/gcompartment.ts +47 -0
- package/src/gedge-layoutable.ts +45 -0
- package/src/gedge.ts +80 -0
- package/src/ggraph.ts +49 -0
- package/src/gissue-marker.ts +49 -0
- package/src/glabel.ts +50 -0
- package/src/glayout-container.ts +36 -0
- package/src/glayoutable.ts +57 -0
- package/src/gmodel-element.spec.ts +18 -0
- package/src/gmodel-element.ts +218 -0
- package/src/gmodel-util.ts +58 -0
- package/src/gnode.ts +34 -0
- package/src/gport.ts +26 -0
- package/src/gpre-rendered-element.ts +40 -0
- package/src/gshape-element.ts +51 -0
- package/src/index.ts +33 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
2
|
+
export declare type GIssueSeverity = 'error' | 'warning' | 'info';
|
|
3
|
+
export declare class GIssue {
|
|
4
|
+
message: string;
|
|
5
|
+
severity: GIssueSeverity;
|
|
6
|
+
}
|
|
7
|
+
export declare class GIssueMarker extends GShapeElement {
|
|
8
|
+
type: string;
|
|
9
|
+
issues: GIssue[];
|
|
10
|
+
}
|
|
11
|
+
export declare class GIssueMarkerBuilder<G extends GIssueMarker = GIssueMarker> extends GShapeElementBuilder<G> {
|
|
12
|
+
addIssue(issue: GIssue): this;
|
|
13
|
+
addIssue(message: string, severity: GIssueSeverity): this;
|
|
14
|
+
addIssues(issues: GIssue[]): this;
|
|
15
|
+
addIssues(...issues: GIssue[]): this;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=gissue-marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gissue-marker.d.ts","sourceRoot":"","sources":["../src/gissue-marker.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,oBAAY,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D,qBAAa,MAAM;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;CAC5B;AAED,qBAAa,YAAa,SAAQ,aAAa;IAClC,IAAI,SAA6B;IAC1C,MAAM,EAAE,MAAM,EAAE,CAAM;CACzB;AAED,qBAAa,mBAAmB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IACnG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;IAUzD,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;IACjC,SAAS,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;CAKvC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GIssueMarkerBuilder = exports.GIssueMarker = exports.GIssue = void 0;
|
|
4
|
+
/********************************************************************************
|
|
5
|
+
* Copyright (c) 2022 STMicroelectronics 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 protocol_1 = require("@eclipse-glsp/protocol");
|
|
20
|
+
const gshape_element_1 = require("./gshape-element");
|
|
21
|
+
class GIssue {
|
|
22
|
+
}
|
|
23
|
+
exports.GIssue = GIssue;
|
|
24
|
+
class GIssueMarker extends gshape_element_1.GShapeElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.type = protocol_1.DefaultTypes.ISSUE_MARKER;
|
|
28
|
+
this.issues = [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.GIssueMarker = GIssueMarker;
|
|
32
|
+
class GIssueMarkerBuilder extends gshape_element_1.GShapeElementBuilder {
|
|
33
|
+
addIssue(issueOrMessage, severity) {
|
|
34
|
+
if (typeof issueOrMessage === 'object') {
|
|
35
|
+
this.proxy.issues.push(issueOrMessage);
|
|
36
|
+
}
|
|
37
|
+
else if (severity) {
|
|
38
|
+
this.proxy.issues.push({ message: issueOrMessage, severity });
|
|
39
|
+
}
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
addIssues(...issues) {
|
|
43
|
+
(0, protocol_1.flatPush)(this.proxy.issues, issues);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.GIssueMarkerBuilder = GIssueMarkerBuilder;
|
|
48
|
+
//# sourceMappingURL=gissue-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gissue-marker.js","sourceRoot":"","sources":["../src/gissue-marker.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA4E;AAC5E,qDAAuE;AAIvE,MAAa,MAAM;CAGlB;AAHD,wBAGC;AAED,MAAa,YAAa,SAAQ,8BAAa;IAA/C;;QACa,SAAI,GAAG,uBAAY,CAAC,YAAY,CAAC;QAC1C,WAAM,GAAa,EAAE,CAAC;IAC1B,CAAC;CAAA;AAHD,oCAGC;AAED,MAAa,mBAA2D,SAAQ,qCAAuB;IAGnG,QAAQ,CAAC,cAA+B,EAAE,QAAyB;QAC/D,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;YACpC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAC1C;aAAM,IAAI,QAAQ,EAAE;YACjB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAC;SACjE;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAID,SAAS,CAAC,GAAG,MAA4B;QACrC,IAAA,mBAAQ,EAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlBD,kDAkBC"}
|
package/lib/glabel.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 STMicroelectronics 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 { Point } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GAlignable } from './galignable';
|
|
18
|
+
import { EdgePlacement, GEdgeLayoutable } from './gedge-layoutable';
|
|
19
|
+
import { GModelElementConstructor } from './gmodel-element';
|
|
20
|
+
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
21
|
+
export declare class GLabel extends GShapeElement implements GAlignable, GEdgeLayoutable {
|
|
22
|
+
static builder<G extends GLabel = GLabel>(constructor?: GModelElementConstructor<G>): GLabelBuilder;
|
|
23
|
+
type: string;
|
|
24
|
+
text: string;
|
|
25
|
+
alignment: Point;
|
|
26
|
+
edgePlacement?: EdgePlacement;
|
|
27
|
+
[GAlignable]: boolean;
|
|
28
|
+
[GEdgeLayoutable]: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare class GLabelBuilder<G extends GLabel = GLabel> extends GShapeElementBuilder<G> {
|
|
31
|
+
alignment(x: number, y: number): this;
|
|
32
|
+
alignment(alignment: Point): this;
|
|
33
|
+
text(text: string): this;
|
|
34
|
+
edgePlacement(placement: EdgePlacement): this;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=glabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glabel.d.ts","sourceRoot":"","sources":["../src/glabel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAgB,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAqB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,qBAAa,MAAO,SAAQ,aAAc,YAAW,UAAU,EAAE,eAAe;IAC5E,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,aAAa;IAI1F,IAAI,SAAsB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,CAAgB;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,CAAC,UAAU,CAAC,UAAQ;IACpB,CAAC,eAAe,CAAC,UAAQ;CAC5B;AAED,qBAAa,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IACjF,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IACrC,SAAS,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI;IAKjC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI;CAGhD"}
|
package/lib/glabel.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GLabelBuilder = exports.GLabel = void 0;
|
|
5
|
+
/********************************************************************************
|
|
6
|
+
* Copyright (c) 2022 STMicroelectronics and others.
|
|
7
|
+
*
|
|
8
|
+
* This program and the accompanying materials are made available under the
|
|
9
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
*
|
|
12
|
+
* This Source Code may also be made available under the following Secondary
|
|
13
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
* with the GNU Classpath Exception which is available at
|
|
16
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
*
|
|
18
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
19
|
+
********************************************************************************/
|
|
20
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
21
|
+
const galignable_1 = require("./galignable");
|
|
22
|
+
const gedge_layoutable_1 = require("./gedge-layoutable");
|
|
23
|
+
const gshape_element_1 = require("./gshape-element");
|
|
24
|
+
class GLabel extends gshape_element_1.GShapeElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.type = protocol_1.DefaultTypes.LABEL;
|
|
28
|
+
this.alignment = protocol_1.Point.ORIGIN;
|
|
29
|
+
this[_a] = true;
|
|
30
|
+
this[_b] = true;
|
|
31
|
+
}
|
|
32
|
+
static builder(constructor) {
|
|
33
|
+
return new GLabelBuilder(constructor !== null && constructor !== void 0 ? constructor : GLabel).type(protocol_1.DefaultTypes.LABEL);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.GLabel = GLabel;
|
|
37
|
+
_a = galignable_1.GAlignable, _b = gedge_layoutable_1.GEdgeLayoutable;
|
|
38
|
+
class GLabelBuilder extends gshape_element_1.GShapeElementBuilder {
|
|
39
|
+
alignment(xOrAlign, y) {
|
|
40
|
+
return galignable_1.GAlignableBuilder.alignment(this, xOrAlign, y);
|
|
41
|
+
}
|
|
42
|
+
text(text) {
|
|
43
|
+
this.proxy.text = text;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
edgePlacement(placement) {
|
|
47
|
+
return gedge_layoutable_1.GEdgeLayoutableBuilder.edgePlacement(this, placement);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.GLabelBuilder = GLabelBuilder;
|
|
51
|
+
//# sourceMappingURL=glabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glabel.js","sourceRoot":"","sources":["../src/glabel.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA6D;AAC7D,6CAA6D;AAC7D,yDAA4F;AAE5F,qDAAuE;AAEvE,MAAa,MAAO,SAAQ,8BAAa;IAAzC;;QAKa,SAAI,GAAG,uBAAY,CAAC,KAAK,CAAC;QAEnC,cAAS,GAAU,gBAAK,CAAC,MAAM,CAAC;QAEhC,QAAY,GAAG,IAAI,CAAC;QACpB,QAAiB,GAAG,IAAI,CAAC;IAC7B,CAAC;IAVG,MAAM,CAAC,OAAO,CAA4B,WAAyC;QAC/E,OAAO,IAAI,aAAa,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,MAAM,CAAC,CAAC,IAAI,CAAC,uBAAY,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;CAQJ;AAXD,wBAWC;KAFI,uBAAU,OACV,kCAAe;AAGpB,MAAa,aAAyC,SAAQ,qCAAuB;IAGjF,SAAS,CAAC,QAAwB,EAAE,CAAU;QAC1C,OAAO,8BAAiB,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,CAAC,IAAY;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,SAAwB;QAClC,OAAO,yCAAsB,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACjE,CAAC;CACJ;AAfD,sCAeC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 STMicroelectronics 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 { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
17
|
+
export declare const GLayoutContainer: unique symbol;
|
|
18
|
+
export interface GLayoutContainer {
|
|
19
|
+
layout?: string;
|
|
20
|
+
[GLayoutContainer]: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function isGLayoutContainer<G extends GModelElement>(element: G): element is G & GLayoutContainer;
|
|
23
|
+
export declare type GLayoutContainerBuilder = GModelElementBuilder<GModelElement & GLayoutContainer>;
|
|
24
|
+
export declare namespace GLayoutContainerBuilder {
|
|
25
|
+
function layout<B extends GLayoutContainerBuilder>(builder: B, newLayout?: string): B;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=glayout-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glayout-container.d.ts","sourceRoot":"","sources":["../src/glayout-container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,aAAa,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,gBAAgB,CAEvG;AAED,oBAAY,uBAAuB,GAAG,oBAAoB,CAAC,aAAa,GAAG,gBAAgB,CAAC,CAAC;AAE7F,yBAAiB,uBAAuB,CAAC;IACrC,SAAgB,MAAM,CAAC,CAAC,SAAS,uBAAuB,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAG3F;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLayoutContainerBuilder = exports.isGLayoutContainer = exports.GLayoutContainer = void 0;
|
|
4
|
+
exports.GLayoutContainer = Symbol('GLayoutContainer');
|
|
5
|
+
function isGLayoutContainer(element) {
|
|
6
|
+
return (element[exports.GLayoutContainer] = true);
|
|
7
|
+
}
|
|
8
|
+
exports.isGLayoutContainer = isGLayoutContainer;
|
|
9
|
+
var GLayoutContainerBuilder;
|
|
10
|
+
(function (GLayoutContainerBuilder) {
|
|
11
|
+
function layout(builder, newLayout) {
|
|
12
|
+
builder['proxy'].layout = newLayout;
|
|
13
|
+
return builder;
|
|
14
|
+
}
|
|
15
|
+
GLayoutContainerBuilder.layout = layout;
|
|
16
|
+
})(GLayoutContainerBuilder = exports.GLayoutContainerBuilder || (exports.GLayoutContainerBuilder = {}));
|
|
17
|
+
//# sourceMappingURL=glayout-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glayout-container.js","sourceRoot":"","sources":["../src/glayout-container.ts"],"names":[],"mappings":";;;AAiBa,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAO3D,SAAgB,kBAAkB,CAA0B,OAAU;IAClE,OAAO,CAAE,OAAe,CAAC,wBAAgB,CAAC,GAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AAFD,gDAEC;AAID,IAAiB,uBAAuB,CAKvC;AALD,WAAiB,uBAAuB;IACpC,SAAgB,MAAM,CAAoC,OAAU,EAAE,SAAkB;QACpF,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC;QACpC,OAAO,OAAO,CAAC;IACnB,CAAC;IAHe,8BAAM,SAGrB,CAAA;AACL,CAAC,EALgB,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAKvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 STMicroelectronics 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 { Args, JsonPrimitive } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
18
|
+
export declare const GLayoutable: unique symbol;
|
|
19
|
+
export interface GLayoutable {
|
|
20
|
+
layoutOptions?: Args;
|
|
21
|
+
[GLayoutable]: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function isGLayoutable<G extends GModelElement>(element: G): element is G & GLayoutable;
|
|
24
|
+
export declare type GLayoutableBuilder = GModelElementBuilder<GModelElement & GLayoutable>;
|
|
25
|
+
export declare namespace GLayoutableBuilder {
|
|
26
|
+
function addLayoutOption<B extends GLayoutableBuilder>(builder: B, key: string, value: JsonPrimitive): B;
|
|
27
|
+
function addLayoutOptions<B extends GLayoutableBuilder>(builder: B, layoutOptions: Args | Map<string, JsonPrimitive>): B;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=glayoutable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glayoutable.d.ts","sourceRoot":"","sources":["../src/glayoutable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,eAAO,MAAM,WAAW,eAAwB,CAAC;AAEjD,MAAM,WAAW,WAAW;IACxB,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,aAAa,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,WAAW,CAE7F;AAED,oBAAY,kBAAkB,GAAG,oBAAoB,CAAC,aAAa,GAAG,WAAW,CAAC,CAAC;AAEnF,yBAAiB,kBAAkB,CAAC;IAChC,SAAgB,eAAe,CAAC,CAAC,SAAS,kBAAkB,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,CAAC,CAO9G;IAED,SAAgB,gBAAgB,CAAC,CAAC,SAAS,kBAAkB,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAc9H;CACJ"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLayoutableBuilder = exports.isGLayoutable = exports.GLayoutable = void 0;
|
|
4
|
+
exports.GLayoutable = Symbol('GLayoutable');
|
|
5
|
+
function isGLayoutable(element) {
|
|
6
|
+
return (element[exports.GLayoutable] = true);
|
|
7
|
+
}
|
|
8
|
+
exports.isGLayoutable = isGLayoutable;
|
|
9
|
+
var GLayoutableBuilder;
|
|
10
|
+
(function (GLayoutableBuilder) {
|
|
11
|
+
function addLayoutOption(builder, key, value) {
|
|
12
|
+
const proxy = builder['proxy'];
|
|
13
|
+
if (!proxy.layoutOptions) {
|
|
14
|
+
proxy.layoutOptions = {};
|
|
15
|
+
}
|
|
16
|
+
proxy.layoutOptions[key] = value;
|
|
17
|
+
return builder;
|
|
18
|
+
}
|
|
19
|
+
GLayoutableBuilder.addLayoutOption = addLayoutOption;
|
|
20
|
+
function addLayoutOptions(builder, layoutOptions) {
|
|
21
|
+
const toAssign = {};
|
|
22
|
+
const proxy = builder['proxy'];
|
|
23
|
+
if (layoutOptions instanceof Map) {
|
|
24
|
+
[...layoutOptions.keys()].forEach(key => (toAssign[key] = layoutOptions.get(key)));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
Object.keys(layoutOptions).forEach(key => (toAssign[key] = layoutOptions[key]));
|
|
28
|
+
}
|
|
29
|
+
if (proxy.layoutOptions) {
|
|
30
|
+
Object.assign(proxy.layoutOptions, toAssign);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
proxy.layoutOptions = toAssign;
|
|
34
|
+
}
|
|
35
|
+
return builder;
|
|
36
|
+
}
|
|
37
|
+
GLayoutableBuilder.addLayoutOptions = addLayoutOptions;
|
|
38
|
+
})(GLayoutableBuilder = exports.GLayoutableBuilder || (exports.GLayoutableBuilder = {}));
|
|
39
|
+
//# sourceMappingURL=glayoutable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glayoutable.js","sourceRoot":"","sources":["../src/glayoutable.ts"],"names":[],"mappings":";;;AAkBa,QAAA,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAOjD,SAAgB,aAAa,CAA0B,OAAU;IAC7D,OAAO,CAAE,OAAe,CAAC,mBAAW,CAAC,GAAG,IAAI,CAAC,CAAC;AAClD,CAAC;AAFD,sCAEC;AAID,IAAiB,kBAAkB,CAyBlC;AAzBD,WAAiB,kBAAkB;IAC/B,SAAgB,eAAe,CAA+B,OAAU,EAAE,GAAW,EAAE,KAAoB;QACvG,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YACtB,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC;SAC5B;QACD,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACjC,OAAO,OAAO,CAAC;IACnB,CAAC;IAPe,kCAAe,kBAO9B,CAAA;IAED,SAAgB,gBAAgB,CAA+B,OAAU,EAAE,aAAgD;QACvH,MAAM,QAAQ,GAAS,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/B,IAAI,aAAa,YAAY,GAAG,EAAE;YAC9B,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC;SACvF;aAAM;YACH,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACnF;QACD,IAAI,KAAK,CAAC,aAAa,EAAE;YACrB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;SAChD;aAAM;YACH,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC;SAClC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAde,mCAAgB,mBAc/B,CAAA;AACL,CAAC,EAzBgB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAyBlC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 STMicroelectronics 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 { Args, Bounds, Dimension, JsonPrimitive, Point, SModelElementSchema, SModelRootSchema } from '@eclipse-glsp/protocol';
|
|
17
|
+
export declare type GModelElementConstructor<G extends GModelElement = GModelElement> = new () => G;
|
|
18
|
+
/**
|
|
19
|
+
* Represents a `GModeElement` serialized as plain JSON object.
|
|
20
|
+
*/
|
|
21
|
+
export declare type GModelElementSchema = SModelElementSchema;
|
|
22
|
+
export declare namespace GModelElementSchema {
|
|
23
|
+
/**
|
|
24
|
+
* Typeguard function to check wether the given object is an {@link GModelElementSchema}.
|
|
25
|
+
* @param object The object to check.
|
|
26
|
+
* @returns A type literal indicating wether the given object is of type {@link GModelElementSchema}.
|
|
27
|
+
*/
|
|
28
|
+
const is: typeof SModelElementSchema.is;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Base type for all elements of the graphical model.
|
|
32
|
+
* Each model element must have a unique ID and a type that is used to look up its view.
|
|
33
|
+
*/
|
|
34
|
+
export declare abstract class GModelElement implements GModelElementSchema {
|
|
35
|
+
/**
|
|
36
|
+
* The `type` of a `GModelElement` has two main purposes. It is used by the GLSP client
|
|
37
|
+
* during the rendering phase to lookup the View that is responsible for rendering this element.
|
|
38
|
+
* In addition, it serves as the discriminator for serialization & deserialization of `GModeElements` and their corresponding
|
|
39
|
+
* `GModelElementSchema`. e.g. If the glsp server receives a `GModelElementSchema` (plain JSON object) the type is used to
|
|
40
|
+
* lookup and construct the corresponding `GModelElement` class.
|
|
41
|
+
*/
|
|
42
|
+
type: string;
|
|
43
|
+
/**
|
|
44
|
+
* Each model element must have a unique ID. Duplicate ids in the graphical element will result in an error during the
|
|
45
|
+
* rendering phase.
|
|
46
|
+
*/
|
|
47
|
+
id: string;
|
|
48
|
+
/**
|
|
49
|
+
* A set of css classes that should be applied to the DOM element that corresponds to this element.
|
|
50
|
+
*/
|
|
51
|
+
cssClasses: string[];
|
|
52
|
+
/** A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
|
|
53
|
+
* the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
|
|
54
|
+
* of the DOM element that reflects this element.
|
|
55
|
+
*/
|
|
56
|
+
children: GModelElement[];
|
|
57
|
+
/**
|
|
58
|
+
* Each `GModelElement` (apart from the root element) must have an assigned parent. Orphan elements are not allowed.
|
|
59
|
+
*/
|
|
60
|
+
parent: GModelElement;
|
|
61
|
+
/**
|
|
62
|
+
* Additional custom arguments. Can be used to transmit additional information between client & server without
|
|
63
|
+
* having to extend the model.
|
|
64
|
+
*/
|
|
65
|
+
args?: Args;
|
|
66
|
+
/**
|
|
67
|
+
* Retrieve the {@link GModelRoot} element by traversing up the parent hierachy.
|
|
68
|
+
*/
|
|
69
|
+
get root(): GModelRoot;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A fluent builder API that simplifies the construction of complex {@link GModelElement}s.
|
|
73
|
+
* The builder API is derived from the Java GLSP server implementation where it is used to hide the complexity
|
|
74
|
+
* of creating EMF objects. However, the API is also useful in a Typescript/Node context to declare the creation of a new
|
|
75
|
+
* {@link GModelElement} in a more concise way.
|
|
76
|
+
*/
|
|
77
|
+
export declare abstract class GModelElementBuilder<G extends GModelElement> {
|
|
78
|
+
protected proxy: G;
|
|
79
|
+
protected elementConstructor: GModelElementConstructor<G>;
|
|
80
|
+
constructor(elementConstructor: GModelElementConstructor<G>);
|
|
81
|
+
reset(): this;
|
|
82
|
+
build(): G;
|
|
83
|
+
id(id: string): this;
|
|
84
|
+
type(type: string): this;
|
|
85
|
+
addCssClass(cssClass: string): this;
|
|
86
|
+
addCssClasses(cssClasses: string[]): this;
|
|
87
|
+
addCssClasses(...cssClasses: string[]): this;
|
|
88
|
+
add(child: GModelElement): this;
|
|
89
|
+
addChildren(children: GModelElement[]): this;
|
|
90
|
+
addChildren(...children: GModelElement[]): this;
|
|
91
|
+
addArg(key: string, value: JsonPrimitive): this;
|
|
92
|
+
addArgs(args: Args): this;
|
|
93
|
+
addArgs(args: Map<string, JsonPrimitive>): this;
|
|
94
|
+
}
|
|
95
|
+
export declare type GModelRootSchema = SModelRootSchema;
|
|
96
|
+
export declare class GModelRoot extends GModelElement implements SModelRootSchema {
|
|
97
|
+
static builder(): GModelRootBuilder;
|
|
98
|
+
canvasBounds?: Bounds;
|
|
99
|
+
revision: number;
|
|
100
|
+
}
|
|
101
|
+
export declare class GModelRootBuilder<G extends GModelRoot = GModelRoot> extends GModelElementBuilder<G> {
|
|
102
|
+
revision(revision: number): this;
|
|
103
|
+
canvasBounds(position: Point, size: Dimension): this;
|
|
104
|
+
canvasBounds(bounds: Bounds): this;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=gmodel-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmodel-element.d.ts","sourceRoot":"","sources":["../src/gmodel-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,IAAI,EACJ,MAAM,EACN,SAAS,EAET,aAAa,EAEb,KAAK,EACL,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,wBAAwB,CAAC;AAGhC,oBAAY,wBAAwB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,UAAU,CAAC,CAAC;AAC5F;;GAEG;AACH,oBAAY,mBAAmB,GAAG,mBAAmB,CAAC;AAEtD,yBAAiB,mBAAmB,CAAC;IACjC;;;;OAIG;IACI,MAAM,EAAE,+BAAyB,CAAC;CAC5C;AAED;;;GAGG;AACH,8BAAsB,aAAc,YAAW,mBAAmB;IAC9D;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAM;IAC1B;;;OAGG;IACH,QAAQ,EAAE,aAAa,EAAE,CAAM;IAC/B;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;OAEG;IACH,IAAI,IAAI,IAAI,UAAU,CAMrB;CACJ;AAED;;;;;GAKG;AACH,8BAAsB,oBAAoB,CAAC,CAAC,SAA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EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IACpD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAWrC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GModelRootBuilder = exports.GModelRoot = exports.GModelElementBuilder = exports.GModelElement = exports.GModelElementSchema = void 0;
|
|
4
|
+
/********************************************************************************
|
|
5
|
+
* Copyright (c) 2022 STMicroelectronics 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 protocol_1 = require("@eclipse-glsp/protocol");
|
|
20
|
+
const uuid = require("uuid");
|
|
21
|
+
var GModelElementSchema;
|
|
22
|
+
(function (GModelElementSchema) {
|
|
23
|
+
/**
|
|
24
|
+
* Typeguard function to check wether the given object is an {@link GModelElementSchema}.
|
|
25
|
+
* @param object The object to check.
|
|
26
|
+
* @returns A type literal indicating wether the given object is of type {@link GModelElementSchema}.
|
|
27
|
+
*/
|
|
28
|
+
GModelElementSchema.is = protocol_1.SModelElementSchema.is;
|
|
29
|
+
})(GModelElementSchema = exports.GModelElementSchema || (exports.GModelElementSchema = {}));
|
|
30
|
+
/**
|
|
31
|
+
* Base type for all elements of the graphical model.
|
|
32
|
+
* Each model element must have a unique ID and a type that is used to look up its view.
|
|
33
|
+
*/
|
|
34
|
+
class GModelElement {
|
|
35
|
+
constructor() {
|
|
36
|
+
/**
|
|
37
|
+
* A set of css classes that should be applied to the DOM element that corresponds to this element.
|
|
38
|
+
*/
|
|
39
|
+
this.cssClasses = [];
|
|
40
|
+
/** A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
|
|
41
|
+
* the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
|
|
42
|
+
* of the DOM element that reflects this element.
|
|
43
|
+
*/
|
|
44
|
+
this.children = [];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Retrieve the {@link GModelRoot} element by traversing up the parent hierachy.
|
|
48
|
+
*/
|
|
49
|
+
get root() {
|
|
50
|
+
let current = this;
|
|
51
|
+
while (!(current instanceof GModelRoot)) {
|
|
52
|
+
current = current.parent;
|
|
53
|
+
}
|
|
54
|
+
return current;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.GModelElement = GModelElement;
|
|
58
|
+
/**
|
|
59
|
+
* A fluent builder API that simplifies the construction of complex {@link GModelElement}s.
|
|
60
|
+
* The builder API is derived from the Java GLSP server implementation where it is used to hide the complexity
|
|
61
|
+
* of creating EMF objects. However, the API is also useful in a Typescript/Node context to declare the creation of a new
|
|
62
|
+
* {@link GModelElement} in a more concise way.
|
|
63
|
+
*/
|
|
64
|
+
class GModelElementBuilder {
|
|
65
|
+
constructor(elementConstructor) {
|
|
66
|
+
this.elementConstructor = elementConstructor;
|
|
67
|
+
this.proxy = new elementConstructor();
|
|
68
|
+
this.proxy.cssClasses = [];
|
|
69
|
+
this.proxy.children = [];
|
|
70
|
+
this.proxy.id = uuid.v4();
|
|
71
|
+
}
|
|
72
|
+
reset() {
|
|
73
|
+
this.proxy = new this.elementConstructor();
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
build() {
|
|
77
|
+
const element = new this.elementConstructor();
|
|
78
|
+
Object.assign(element, this.proxy);
|
|
79
|
+
element.children.forEach(child => (child.parent = element));
|
|
80
|
+
if (element.id === undefined) {
|
|
81
|
+
throw new Error('The `id` property of a GModelElement must not be undefined!');
|
|
82
|
+
}
|
|
83
|
+
if (element.type === undefined) {
|
|
84
|
+
throw new Error('The `type` property of a GModelElement must not be undefined!');
|
|
85
|
+
}
|
|
86
|
+
return element;
|
|
87
|
+
}
|
|
88
|
+
id(id) {
|
|
89
|
+
this.proxy.id = id;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
type(type) {
|
|
93
|
+
this.proxy.type = type;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
addCssClass(cssClass) {
|
|
97
|
+
this.proxy.cssClasses.push(cssClass);
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
addCssClasses(...cssClasses) {
|
|
101
|
+
(0, protocol_1.flatPush)(this.proxy.cssClasses, cssClasses);
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
add(child) {
|
|
105
|
+
this.proxy.children.push(child);
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
addChildren(...children) {
|
|
109
|
+
(0, protocol_1.flatPush)(this.proxy.children, children);
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
addArg(key, value) {
|
|
113
|
+
if (!this.proxy.args) {
|
|
114
|
+
this.proxy.args = {};
|
|
115
|
+
}
|
|
116
|
+
this.proxy.args[key] = value;
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
addArgs(args) {
|
|
120
|
+
const toAssign = {};
|
|
121
|
+
if (args instanceof Map) {
|
|
122
|
+
[...args.keys()].forEach(key => (toAssign[key] = args.get(key)));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
Object.keys(args).forEach(key => (toAssign[key] = args[key]));
|
|
126
|
+
}
|
|
127
|
+
if (this.proxy.args) {
|
|
128
|
+
Object.assign(this.proxy.args, toAssign);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.proxy.args = toAssign;
|
|
132
|
+
}
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.GModelElementBuilder = GModelElementBuilder;
|
|
137
|
+
class GModelRoot extends GModelElement {
|
|
138
|
+
constructor() {
|
|
139
|
+
super(...arguments);
|
|
140
|
+
this.revision = 0;
|
|
141
|
+
}
|
|
142
|
+
static builder() {
|
|
143
|
+
return new GModelRootBuilder(GModelRoot);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.GModelRoot = GModelRoot;
|
|
147
|
+
class GModelRootBuilder extends GModelElementBuilder {
|
|
148
|
+
revision(revision) {
|
|
149
|
+
this.proxy.revision = revision;
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
canvasBounds(positionOrBounds, size) {
|
|
153
|
+
let bounds;
|
|
154
|
+
if (size) {
|
|
155
|
+
bounds = Object.assign(Object.assign({}, positionOrBounds), size);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
bounds = positionOrBounds;
|
|
159
|
+
}
|
|
160
|
+
this.proxy.canvasBounds = bounds;
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.GModelRootBuilder = GModelRootBuilder;
|
|
165
|
+
//# sourceMappingURL=gmodel-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmodel-element.js","sourceRoot":"","sources":["../src/gmodel-element.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAUgC;AAChC,6BAA6B;AAQ7B,IAAiB,mBAAmB,CAOnC;AAPD,WAAiB,mBAAmB;IAChC;;;;OAIG;IACU,sBAAE,GAAG,8BAAmB,CAAC,EAAE,CAAC;AAC7C,CAAC,EAPgB,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAOnC;AAED;;;GAGG;AACH,MAAsB,aAAa;IAAnC;QAcI;;WAEG;QACH,eAA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;AAlBD,8CAkBC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 STMicroelectronics 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 { GModelElement, GModelElementConstructor } from '.';
|
|
17
|
+
export declare type Predicate<T> = (element: T) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the first element matching the search predicate starting from the given
|
|
20
|
+
* element and walking up the parent hierarchy.
|
|
21
|
+
*
|
|
22
|
+
* @param element The element to start the search from.
|
|
23
|
+
* @param searchPredicate The predicate which the element should match.
|
|
24
|
+
* @returns The first matching element or `undefined`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function findParent(element: GModelElement, searchPredicate: Predicate<GModelElement>): GModelElement | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the first parent element that is an instance of the given {@link GModelElementConstructor} starting from the given element.
|
|
29
|
+
* (recursively walking up the parent hierarchy).
|
|
30
|
+
*
|
|
31
|
+
* @param element The element to start the search from.
|
|
32
|
+
* @param constructor The queried parent class ({@link GModelElementConstructor}).
|
|
33
|
+
* @returns The first matching parent element or `undefined`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function findParentByClass<G extends GModelElement>(element: GModelElement, constructor: GModelElementConstructor<G>): G | undefined;
|
|
36
|
+
//# sourceMappingURL=gmodel-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmodel-util.d.ts","sourceRoot":"","sources":["../src/gmodel-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,GAAG,CAAC;AAE5D,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,CAAC,aAAa,CAAC,GAAG,aAAa,GAAG,SAAS,CASvH;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,EACrD,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACzC,CAAC,GAAG,SAAS,CAOf"}
|