@eclipse-glsp/graph 0.9.0-next.5ce3b9a.1
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 +46 -0
- package/lib/gedge.d.ts.map +1 -0
- package/lib/gedge.js +88 -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 +97 -0
- package/lib/gmodel-element.d.ts.map +1 -0
- package/lib/gmodel-element.js +161 -0
- package/lib/gmodel-element.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 +33 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +45 -0
- package/lib/index.js.map +1 -0
- package/package.json +63 -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 +100 -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 +216 -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 +32 -0
package/lib/ggraph.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GGraphBuilder = exports.GGraph = void 0;
|
|
5
|
+
/********************************************************************************
|
|
6
|
+
* Copyright (c) 2022 StMicroelectronics.
|
|
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
|
+
/**
|
|
21
|
+
* TS implementation of the GLSP graph definition
|
|
22
|
+
* (https://github.com/eclipse-glsp/glsp-server/tree/master/plugins/org.eclipse.glsp.graph/src-gen/org/eclipse/glsp/graph)
|
|
23
|
+
* Parts of the implementation is derived from Sprotty's SModel API
|
|
24
|
+
* (https://github.com/eclipse/sprotty/blob/master/packages/sprotty/src/base/model/smodel.ts)
|
|
25
|
+
*/
|
|
26
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
27
|
+
const gbound_aware_1 = require("./gbound-aware");
|
|
28
|
+
const gmodel_element_1 = require("./gmodel-element");
|
|
29
|
+
class GGraph extends gmodel_element_1.GModelRoot {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.type = protocol_1.DefaultTypes.GRAPH;
|
|
33
|
+
this.position = protocol_1.ORIGIN_POINT;
|
|
34
|
+
this[_a] = true;
|
|
35
|
+
}
|
|
36
|
+
static builder() {
|
|
37
|
+
return new GGraphBuilder(GGraph);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.GGraph = GGraph;
|
|
41
|
+
_a = gbound_aware_1.GBoundsAware;
|
|
42
|
+
class GGraphBuilder extends gmodel_element_1.GModelRootBuilder {
|
|
43
|
+
position(positionOrX, y) {
|
|
44
|
+
return gbound_aware_1.GBoundsAwareBuilder.position(this, positionOrX, y);
|
|
45
|
+
}
|
|
46
|
+
size(sizeOrWidth, height) {
|
|
47
|
+
return gbound_aware_1.GBoundsAwareBuilder.size(this, sizeOrWidth, height);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.GGraphBuilder = GGraphBuilder;
|
|
51
|
+
//# sourceMappingURL=ggraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ggraph.js","sourceRoot":"","sources":["../src/ggraph.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF;;;;;GAKG;AACH,qDAA+F;AAC/F,iDAAmE;AACnE,qDAAiE;AAEjE,MAAa,MAAO,SAAQ,2BAAU;IAAtC;;QAKI,SAAI,GAAG,uBAAK,CAAC,KAAK,CAAC;QACnB,aAAQ,GAAU,uBAAY,CAAC;QAE/B,QAAc,GAAG,IAAI,CAAC;IAC1B,CAAC;IARG,MAAM,CAAC,OAAO;QACV,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CAMJ;AATD,wBASC;KADI,2BAAY;AAGjB,MAAa,aAAyC,SAAQ,kCAAoB;IAG9E,QAAQ,CAAC,WAA2B,EAAE,CAAU;QAC5C,OAAO,kCAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;IAC9D,CAAC;IAID,IAAI,CAAC,WAA+B,EAAE,MAAe;QACjD,OAAO,kCAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACJ;AAZD,sCAYC"}
|
|
@@ -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;IAC3C,IAAI,SAA6B;IACjC,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
|
+
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;;QACI,SAAI,GAAG,uBAAY,CAAC,YAAY,CAAC;QACjC,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,mBAAQ,CAAC,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,EAA8B,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC3E,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;IAInG,IAAI,SAAsB;IAC1B,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.ORIGIN_POINT;
|
|
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,qDAA2E;AAC3E,6CAA6D;AAC7D,yDAA4F;AAE5F,qDAAuE;AAEvE,MAAa,MAAO,SAAQ,8BAAa;IAAzC;;QAKI,SAAI,GAAG,uBAAY,CAAC,KAAK,CAAC;QAE1B,cAAS,GAAU,uBAAY,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,97 @@
|
|
|
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 function isGModelElementSchema(schema: any): schema is GModelElementSchema;
|
|
23
|
+
/**
|
|
24
|
+
* Base type for all elements of the graphical model.
|
|
25
|
+
* Each model element must have a unique ID and a type that is used to look up its view.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class GModelElement implements GModelElementSchema {
|
|
28
|
+
/**
|
|
29
|
+
* The `type` of a `GModelElement` has two main purposes. It is used by the GLSP client
|
|
30
|
+
* during the rendering phase to lookup the View that is responsible for rendering this element.
|
|
31
|
+
* In addition, it serves as the discriminator for serialization & deserialization of `GModeElements` and their corresponding
|
|
32
|
+
* `GModelElementSchema`. e.g. If the glsp server receives a `GModelElementSchema` (plain JSON object) the type is used to
|
|
33
|
+
* lookup and construct the corresponding `GModelElement` class.
|
|
34
|
+
*/
|
|
35
|
+
type: string;
|
|
36
|
+
/**
|
|
37
|
+
* Each model element must have a unique ID. Duplicate ids in the graphical element will result in an error during the
|
|
38
|
+
* rendering phase.
|
|
39
|
+
*/
|
|
40
|
+
id: string;
|
|
41
|
+
/**
|
|
42
|
+
* A set of css classes that should be applied to the DOM element that corresponds to this element.
|
|
43
|
+
*/
|
|
44
|
+
cssClasses: string[];
|
|
45
|
+
/** A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
|
|
46
|
+
* the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
|
|
47
|
+
* of the DOM element that reflects this element.
|
|
48
|
+
*/
|
|
49
|
+
children: GModelElement[];
|
|
50
|
+
/**
|
|
51
|
+
* Each `GModelElement` (apart from the root element) must have an assigned parent. Orphan elements are not allowed.
|
|
52
|
+
*/
|
|
53
|
+
parent: GModelElement;
|
|
54
|
+
/**
|
|
55
|
+
* Additional custom arguments. Can be used to transmit additional information between client & server without
|
|
56
|
+
* having to extend the model.
|
|
57
|
+
*/
|
|
58
|
+
args?: Args;
|
|
59
|
+
get root(): GModelRoot;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A fluent builder API that simplifies the construction of complex {@link GModelElement}s.
|
|
63
|
+
* The builder API is derived from the Java GLSP server implementation where it is used to hide the complexity
|
|
64
|
+
* of creating EMF objects. However, the API is also useful in a Typescript/Node context to declare the creation of a new
|
|
65
|
+
* {@link GModelElement} in a more concise way.
|
|
66
|
+
*/
|
|
67
|
+
export declare abstract class GModelElementBuilder<G extends GModelElement> {
|
|
68
|
+
protected proxy: G;
|
|
69
|
+
protected elementConstructor: GModelElementConstructor<G>;
|
|
70
|
+
constructor(elementConstructor: GModelElementConstructor<G>);
|
|
71
|
+
reset(): this;
|
|
72
|
+
build(): G;
|
|
73
|
+
id(id: string): this;
|
|
74
|
+
type(type: string): this;
|
|
75
|
+
addCssClass(cssClass: string): this;
|
|
76
|
+
addCssClasses(cssClasses: string[]): this;
|
|
77
|
+
addCssClasses(...cssClasses: string[]): this;
|
|
78
|
+
add(child: GModelElement): this;
|
|
79
|
+
addChildren(children: GModelElement[]): this;
|
|
80
|
+
addChildren(...children: GModelElement[]): this;
|
|
81
|
+
addArg(key: string, value: JsonPrimitive): this;
|
|
82
|
+
addArgs(args: Args): this;
|
|
83
|
+
addArgs(args: Map<string, JsonPrimitive>): this;
|
|
84
|
+
}
|
|
85
|
+
export declare type GModelRootSchema = SModelRootSchema;
|
|
86
|
+
export declare function isGModelRootSchema(schema: any): schema is GModelRootSchema;
|
|
87
|
+
export declare class GModelRoot extends GModelElement implements SModelRootSchema {
|
|
88
|
+
static builder(): GModelRootBuilder;
|
|
89
|
+
canvasBounds?: Bounds;
|
|
90
|
+
revision: number;
|
|
91
|
+
}
|
|
92
|
+
export declare class GModelRootBuilder<G extends GModelRoot = GModelRoot> extends GModelElementBuilder<G> {
|
|
93
|
+
revision(revision: number): this;
|
|
94
|
+
canvasBounds(position: Point, size: Dimension): this;
|
|
95
|
+
canvasBounds(bounds: Bounds): this;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=gmodel-element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exports.GModelElementBuilder = exports.GModelElement = exports.isGModelElementSchema = 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
|
+
function isGModelElementSchema(schema) {
|
|
22
|
+
return protocol_1.isSModelElementSchema(schema);
|
|
23
|
+
}
|
|
24
|
+
exports.isGModelElementSchema = isGModelElementSchema;
|
|
25
|
+
/**
|
|
26
|
+
* Base type for all elements of the graphical model.
|
|
27
|
+
* Each model element must have a unique ID and a type that is used to look up its view.
|
|
28
|
+
*/
|
|
29
|
+
class GModelElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
/**
|
|
32
|
+
* A set of css classes that should be applied to the DOM element that corresponds to this element.
|
|
33
|
+
*/
|
|
34
|
+
this.cssClasses = [];
|
|
35
|
+
/** A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
|
|
36
|
+
* the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
|
|
37
|
+
* of the DOM element that reflects this element.
|
|
38
|
+
*/
|
|
39
|
+
this.children = [];
|
|
40
|
+
}
|
|
41
|
+
get root() {
|
|
42
|
+
let current = this;
|
|
43
|
+
while (!(current instanceof GModelRoot)) {
|
|
44
|
+
current = current.parent;
|
|
45
|
+
}
|
|
46
|
+
return current;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.GModelElement = GModelElement;
|
|
50
|
+
/**
|
|
51
|
+
* A fluent builder API that simplifies the construction of complex {@link GModelElement}s.
|
|
52
|
+
* The builder API is derived from the Java GLSP server implementation where it is used to hide the complexity
|
|
53
|
+
* of creating EMF objects. However, the API is also useful in a Typescript/Node context to declare the creation of a new
|
|
54
|
+
* {@link GModelElement} in a more concise way.
|
|
55
|
+
*/
|
|
56
|
+
class GModelElementBuilder {
|
|
57
|
+
constructor(elementConstructor) {
|
|
58
|
+
this.elementConstructor = elementConstructor;
|
|
59
|
+
this.proxy = new elementConstructor();
|
|
60
|
+
this.proxy.cssClasses = [];
|
|
61
|
+
this.proxy.children = [];
|
|
62
|
+
this.proxy.id = uuid.v4();
|
|
63
|
+
}
|
|
64
|
+
reset() {
|
|
65
|
+
this.proxy = new this.elementConstructor();
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
build() {
|
|
69
|
+
const element = new this.elementConstructor();
|
|
70
|
+
Object.assign(element, this.proxy);
|
|
71
|
+
element.children.forEach(child => (child.parent = element));
|
|
72
|
+
if (element.id === undefined) {
|
|
73
|
+
throw new Error('The `id` property of a GModelElement must not be undefined!');
|
|
74
|
+
}
|
|
75
|
+
if (element.type === undefined) {
|
|
76
|
+
throw new Error('The `type` property of a GModelElement must not be undefined!');
|
|
77
|
+
}
|
|
78
|
+
return element;
|
|
79
|
+
}
|
|
80
|
+
id(id) {
|
|
81
|
+
this.proxy.id = id;
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
type(type) {
|
|
85
|
+
this.proxy.type = type;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
addCssClass(cssClass) {
|
|
89
|
+
this.proxy.cssClasses.push(cssClass);
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
addCssClasses(...cssClasses) {
|
|
93
|
+
protocol_1.flatPush(this.proxy.cssClasses, cssClasses);
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
add(child) {
|
|
97
|
+
this.proxy.children.push(child);
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
addChildren(...children) {
|
|
101
|
+
protocol_1.flatPush(this.proxy.children, children);
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
addArg(key, value) {
|
|
105
|
+
if (!this.proxy.args) {
|
|
106
|
+
this.proxy.args = {};
|
|
107
|
+
}
|
|
108
|
+
this.proxy.args[key] = value;
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
addArgs(args) {
|
|
112
|
+
const toAssign = {};
|
|
113
|
+
if (args instanceof Map) {
|
|
114
|
+
[...args.keys()].forEach(key => (toAssign[key] = args.get(key)));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
Object.keys(args).forEach(key => (toAssign[key] = args[key]));
|
|
118
|
+
}
|
|
119
|
+
if (this.proxy.args) {
|
|
120
|
+
Object.assign(this.proxy.args, toAssign);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.proxy.args = toAssign;
|
|
124
|
+
}
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.GModelElementBuilder = GModelElementBuilder;
|
|
129
|
+
function isGModelRootSchema(schema) {
|
|
130
|
+
return protocol_1.isSModelRootSchema(schema);
|
|
131
|
+
}
|
|
132
|
+
exports.isGModelRootSchema = isGModelRootSchema;
|
|
133
|
+
class GModelRoot extends GModelElement {
|
|
134
|
+
constructor() {
|
|
135
|
+
super(...arguments);
|
|
136
|
+
this.revision = 0;
|
|
137
|
+
}
|
|
138
|
+
static builder() {
|
|
139
|
+
return new GModelRootBuilder(GModelRoot);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.GModelRoot = GModelRoot;
|
|
143
|
+
class GModelRootBuilder extends GModelElementBuilder {
|
|
144
|
+
revision(revision) {
|
|
145
|
+
this.proxy.revision = revision;
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
canvasBounds(positionOrBounds, size) {
|
|
149
|
+
let bounds;
|
|
150
|
+
if (size) {
|
|
151
|
+
bounds = Object.assign(Object.assign({}, positionOrBounds), size);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
bounds = positionOrBounds;
|
|
155
|
+
}
|
|
156
|
+
this.proxy.canvasBounds = bounds;
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.GModelRootBuilder = GModelRootBuilder;
|
|
161
|
+
//# 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,qDAYgC;AAChC,6BAA6B;AAQ7B,SAAgB,qBAAqB,CAAC,MAAW;IAC7C,OAAO,gCAAqB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAFD,sDAEC;AAED;;;GAGG;AACH,MAAsB,aAAa;IAAnC;QAcI;;WAEG;QACH,eAAU,GAAa,EAAE,CAAC;QAC1B;;;WAGG;QACH,aAAQ,GAAoB,EAAE,CAAC;IAkBnC,CAAC;IAPG,IAAI,IAAI;QACJ,IAAI,OAAO,GAAkB,IAAI,CAAC;QAClC,OAAO,CAAC,CAAC,OAAO,YAAY,UAAU,CAAC,EAAE;YACrC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;SAC5B;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAxCD,sCAwCC;AAED;;;;;GAKG;AACH,MAAsB,oBAAoB;IAItC,YAAY,kBAA+C;QACvD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,kBAAkB,EAAE,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C5C;aAAM;YACH,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAxFD,oDAwFC;AAID,SAAgB,kBAAkB,CAAC,MAAW;IAC1C,OAAO,6BAAkB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAFD,gDAEC;AAED,MAAa,UAAW,SAAQ,aAAa;IAA7C;;QAMI,aAAQ,GAAG,CAAC,CAAC;IACjB,CAAC;IANG,MAAM,CAAC,OAAO;QACV,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;CAIJ;AAPD,gCAOC;AAED,MAAa,iBAAqD,SAAQ,oBAAuB;IAC7F,QAAQ,CAAC,QAAgB;QACrB,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAID,YAAY,CAAC,gBAAgC,EAAE,IAAgB;QAC3D,IAAI,MAAc,CAAC;QACnB,IAAI,IAAI,EAAE;YACN,MAAM,mCAAQ,gBAAgB,GAAK,IAAI,CAAE,CAAC;SAC7C;aAAM;YACH,MAAM,GAAG,gBAA0B,CAAC;SACvC;QACD,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlBD,8CAkBC"}
|
package/lib/gnode.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GLayoutContainer } from './glayout-container';
|
|
2
|
+
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
3
|
+
export declare class GNode extends GShapeElement implements GLayoutContainer {
|
|
4
|
+
static builder(): GNodeBuilder;
|
|
5
|
+
type: string;
|
|
6
|
+
layout?: string;
|
|
7
|
+
[GLayoutContainer]: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class GNodeBuilder<G extends GNode = GNode> extends GShapeElementBuilder<G> {
|
|
10
|
+
layout(layout?: string): this;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=gnode.d.ts.map
|