@eclipse-glsp/graph 0.9.0-next.397cddd.4
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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gnode.d.ts","sourceRoot":"","sources":["../src/gnode.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAA2B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,qBAAa,KAAM,SAAQ,aAAc,YAAW,gBAAgB;IAChE,MAAM,CAAC,OAAO,IAAI,YAAY;IAI9B,IAAI,SAAqB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,gBAAgB,CAAC,UAAQ;CAC7B;AAED,qBAAa,YAAY,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IAC9E,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;CAGhC"}
|
package/lib/gnode.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GNodeBuilder = exports.GNode = 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 glayout_container_1 = require("./glayout-container");
|
|
22
|
+
const gshape_element_1 = require("./gshape-element");
|
|
23
|
+
class GNode extends gshape_element_1.GShapeElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.type = protocol_1.DefaultTypes.NODE;
|
|
27
|
+
this[_a] = true;
|
|
28
|
+
}
|
|
29
|
+
static builder() {
|
|
30
|
+
return new GNodeBuilder(GNode).type(protocol_1.DefaultTypes.NODE);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.GNode = GNode;
|
|
34
|
+
_a = glayout_container_1.GLayoutContainer;
|
|
35
|
+
class GNodeBuilder extends gshape_element_1.GShapeElementBuilder {
|
|
36
|
+
layout(layout) {
|
|
37
|
+
return glayout_container_1.GLayoutContainerBuilder.layout(this, layout);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.GNodeBuilder = GNodeBuilder;
|
|
41
|
+
//# sourceMappingURL=gnode.js.map
|
package/lib/gnode.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gnode.js","sourceRoot":"","sources":["../src/gnode.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsD;AACtD,2DAAgF;AAChF,qDAAuE;AAEvE,MAAa,KAAM,SAAQ,8BAAa;IAAxC;;QAKI,SAAI,GAAG,uBAAY,CAAC,IAAI,CAAC;QAEzB,QAAkB,GAAG,IAAI,CAAC;IAC9B,CAAC;IAPG,MAAM,CAAC,OAAO;QACV,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,uBAAY,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;CAKJ;AARD,sBAQC;KADI,oCAAgB;AAGrB,MAAa,YAAsC,SAAQ,qCAAuB;IAC9E,MAAM,CAAC,MAAe;QAClB,OAAO,2CAAuB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ;AAJD,oCAIC"}
|
package/lib/gport.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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 { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
17
|
+
export declare class GPort extends GShapeElement {
|
|
18
|
+
static builder(): GShapeElementBuilder<GPort>;
|
|
19
|
+
type: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=gport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gport.d.ts","sourceRoot":"","sources":["../src/gport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,qBAAa,KAAM,SAAQ,aAAa;IACpC,MAAM,CAAC,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC;IAI7C,IAAI,SAAqB;CAC5B"}
|
package/lib/gport.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2022 STMicroelectronics and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GPort = void 0;
|
|
19
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
20
|
+
const gshape_element_1 = require("./gshape-element");
|
|
21
|
+
class GPort extends gshape_element_1.GShapeElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.type = protocol_1.DefaultTypes.PORT;
|
|
25
|
+
}
|
|
26
|
+
static builder() {
|
|
27
|
+
return new gshape_element_1.GShapeElementBuilder(GPort).type(protocol_1.DefaultTypes.PORT);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.GPort = GPort;
|
|
31
|
+
//# sourceMappingURL=gport.js.map
|
package/lib/gport.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gport.js","sourceRoot":"","sources":["../src/gport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,qDAAsD;AACtD,qDAAuE;AAEvE,MAAa,KAAM,SAAQ,8BAAa;IAAxC;;QAKI,SAAI,GAAG,uBAAY,CAAC,IAAI,CAAC;IAC7B,CAAC;IALG,MAAM,CAAC,OAAO;QACV,OAAO,IAAI,qCAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,uBAAY,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;CAGJ;AAND,sBAMC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Pre-rendered elements contain HTML or SVG code to be transferred to the DOM. This can be useful to
|
|
19
|
+
* render complex figures or to compute the view on the server instead of the client code.
|
|
20
|
+
* Pre rendered elements are often used for the popup model that is created by a `PopupModelFactory`.
|
|
21
|
+
* A popup model is rendered when hovering over a element and for many common use cases e.g rendering a tooltip
|
|
22
|
+
* this model can be computed entirely on the server side.
|
|
23
|
+
*/
|
|
24
|
+
export declare class GPreRenderedElement extends GModelElement {
|
|
25
|
+
static builder(): GPreRenderedElementBuilder;
|
|
26
|
+
code: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class GPreRenderedElementBuilder<G extends GPreRenderedElement = GPreRenderedElement> extends GModelElementBuilder<G> {
|
|
29
|
+
code(code: string): this;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=gpre-rendered-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpre-rendered-element.d.ts","sourceRoot":"","sources":["../src/gpre-rendered-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGvE;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IAClD,MAAM,CAAC,OAAO,IAAI,0BAA0B;IAI5C,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,0BAA0B,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IACxH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAI3B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2022 STMicroelectronics and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GPreRenderedElementBuilder = exports.GPreRenderedElement = void 0;
|
|
19
|
+
const gmodel_element_1 = require("./gmodel-element");
|
|
20
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
21
|
+
/**
|
|
22
|
+
* Pre-rendered elements contain HTML or SVG code to be transferred to the DOM. This can be useful to
|
|
23
|
+
* render complex figures or to compute the view on the server instead of the client code.
|
|
24
|
+
* Pre rendered elements are often used for the popup model that is created by a `PopupModelFactory`.
|
|
25
|
+
* A popup model is rendered when hovering over a element and for many common use cases e.g rendering a tooltip
|
|
26
|
+
* this model can be computed entirely on the server side.
|
|
27
|
+
*/
|
|
28
|
+
class GPreRenderedElement extends gmodel_element_1.GModelElement {
|
|
29
|
+
static builder() {
|
|
30
|
+
return new GPreRenderedElementBuilder(GPreRenderedElement).type(protocol_1.DefaultTypes.PRE_RENDERED);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.GPreRenderedElement = GPreRenderedElement;
|
|
34
|
+
class GPreRenderedElementBuilder extends gmodel_element_1.GModelElementBuilder {
|
|
35
|
+
code(code) {
|
|
36
|
+
this.proxy.code = code;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.GPreRenderedElementBuilder = GPreRenderedElementBuilder;
|
|
41
|
+
//# sourceMappingURL=gpre-rendered-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpre-rendered-element.js","sourceRoot":"","sources":["../src/gpre-rendered-element.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,qDAAuE;AACvE,qDAAsD;AAEtD;;;;;;GAMG;AACH,MAAa,mBAAoB,SAAQ,8BAAa;IAClD,MAAM,CAAC,OAAO;QACV,OAAO,IAAI,0BAA0B,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,uBAAY,CAAC,YAAY,CAAC,CAAC;IAC/F,CAAC;CAGJ;AAND,kDAMC;AAED,MAAa,0BAAgF,SAAQ,qCAAuB;IACxH,IAAI,CAAC,IAAY;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AALD,gEAKC"}
|
|
@@ -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 { Args, Dimension, JsonPrimitive, Point } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GBoundsAware } from './gbound-aware';
|
|
18
|
+
import { GLayoutable } from './glayoutable';
|
|
19
|
+
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
20
|
+
export declare abstract class GShapeElement extends GModelElement implements GBoundsAware, GLayoutable {
|
|
21
|
+
layoutOptions?: Args;
|
|
22
|
+
position: Point;
|
|
23
|
+
size: Dimension;
|
|
24
|
+
[GBoundsAware]: boolean;
|
|
25
|
+
[GLayoutable]: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class GShapeElementBuilder<G extends GShapeElement> extends GModelElementBuilder<G> {
|
|
28
|
+
position(x: number, y: number): this;
|
|
29
|
+
position(position: Point): this;
|
|
30
|
+
size(width: number, height: number): this;
|
|
31
|
+
size(size: Dimension): this;
|
|
32
|
+
addLayoutOption(key: string, value: JsonPrimitive): this;
|
|
33
|
+
addLayoutOptions(layoutOptions: Args): this;
|
|
34
|
+
addLayoutOptions(layoutOptions: Map<string, JsonPrimitive>): this;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=gshape-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gshape-element.d.ts","sourceRoot":"","sources":["../src/gshape-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAsB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,8BAAsB,aAAc,SAAQ,aAAc,YAAW,YAAY,EAAE,WAAW;IAC1F,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,CAAC,YAAY,CAAC,UAAQ;IACtB,CAAC,WAAW,CAAC,UAAQ;CACxB;AAED,qBAAa,oBAAoB,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,oBAAoB,CAAC,CAAC,CAAC;IACtF,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IACpC,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI;IAK/B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IACzC,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAK3B,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAIxD,gBAAgB,CAAC,aAAa,EAAE,IAAI,GAAG,IAAI;IAC3C,gBAAgB,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,IAAI;CAIpE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GShapeElementBuilder = exports.GShapeElement = void 0;
|
|
5
|
+
const gbound_aware_1 = require("./gbound-aware");
|
|
6
|
+
const glayoutable_1 = require("./glayoutable");
|
|
7
|
+
const gmodel_element_1 = require("./gmodel-element");
|
|
8
|
+
class GShapeElement extends gmodel_element_1.GModelElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this[_a] = true;
|
|
12
|
+
this[_b] = true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GShapeElement = GShapeElement;
|
|
16
|
+
_a = gbound_aware_1.GBoundsAware, _b = glayoutable_1.GLayoutable;
|
|
17
|
+
class GShapeElementBuilder extends gmodel_element_1.GModelElementBuilder {
|
|
18
|
+
position(pointOrX, y) {
|
|
19
|
+
return gbound_aware_1.GBoundsAwareBuilder.position(this, pointOrX, y);
|
|
20
|
+
}
|
|
21
|
+
size(sizeOrWidth, height) {
|
|
22
|
+
return gbound_aware_1.GBoundsAwareBuilder.size(this, sizeOrWidth, height);
|
|
23
|
+
}
|
|
24
|
+
addLayoutOption(key, value) {
|
|
25
|
+
return glayoutable_1.GLayoutableBuilder.addLayoutOption(this, key, value);
|
|
26
|
+
}
|
|
27
|
+
addLayoutOptions(layoutOptions) {
|
|
28
|
+
return glayoutable_1.GLayoutableBuilder.addLayoutOptions(this, layoutOptions);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.GShapeElementBuilder = GShapeElementBuilder;
|
|
32
|
+
//# sourceMappingURL=gshape-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gshape-element.js","sourceRoot":"","sources":["../src/gshape-element.ts"],"names":[],"mappings":";;;;AAgBA,iDAAmE;AACnE,+CAAgE;AAChE,qDAAuE;AAEvE,MAAsB,aAAc,SAAQ,8BAAa;IAAzD;;QAII,QAAc,GAAG,IAAI,CAAC;QACtB,QAAa,GAAG,IAAI,CAAC;IACzB,CAAC;CAAA;AAND,sCAMC;KAFI,2BAAY,OACZ,yBAAW;AAGhB,MAAa,oBAA8C,SAAQ,qCAAuB;IAGtF,QAAQ,CAAC,QAAwB,EAAE,CAAU;QACzC,OAAO,kCAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAID,IAAI,CAAC,WAA+B,EAAE,MAAe;QACjD,OAAO,kCAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED,eAAe,CAAC,GAAW,EAAE,KAAoB;QAC7C,OAAO,gCAAkB,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAID,gBAAgB,CAAC,aAAgD;QAC7D,OAAO,gCAAkB,CAAC,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACpE,CAAC;CACJ;AAtBD,oDAsBC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
export * from './default-types';
|
|
17
|
+
export * from './galignable';
|
|
18
|
+
export * from './gbound-aware';
|
|
19
|
+
export * from './gbutton';
|
|
20
|
+
export * from './gcompartment';
|
|
21
|
+
export * from './gedge';
|
|
22
|
+
export * from './gedge-layoutable';
|
|
23
|
+
export * from './ggraph';
|
|
24
|
+
export * from './gissue-marker';
|
|
25
|
+
export * from './glabel';
|
|
26
|
+
export * from './glayout-container';
|
|
27
|
+
export * from './glayoutable';
|
|
28
|
+
export * from './gpre-rendered-element';
|
|
29
|
+
export * from './gmodel-element';
|
|
30
|
+
export * from './gnode';
|
|
31
|
+
export * from './gport';
|
|
32
|
+
export * from './gshape-element';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
/********************************************************************************
|
|
14
|
+
* Copyright (c) 2022 STMicroelectronics and others.
|
|
15
|
+
*
|
|
16
|
+
* This program and the accompanying materials are made available under the
|
|
17
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
18
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
19
|
+
*
|
|
20
|
+
* This Source Code may also be made available under the following Secondary
|
|
21
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
22
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
23
|
+
* with the GNU Classpath Exception which is available at
|
|
24
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
27
|
+
********************************************************************************/
|
|
28
|
+
__exportStar(require("./default-types"), exports);
|
|
29
|
+
__exportStar(require("./galignable"), exports);
|
|
30
|
+
__exportStar(require("./gbound-aware"), exports);
|
|
31
|
+
__exportStar(require("./gbutton"), exports);
|
|
32
|
+
__exportStar(require("./gcompartment"), exports);
|
|
33
|
+
__exportStar(require("./gedge"), exports);
|
|
34
|
+
__exportStar(require("./gedge-layoutable"), exports);
|
|
35
|
+
__exportStar(require("./ggraph"), exports);
|
|
36
|
+
__exportStar(require("./gissue-marker"), exports);
|
|
37
|
+
__exportStar(require("./glabel"), exports);
|
|
38
|
+
__exportStar(require("./glayout-container"), exports);
|
|
39
|
+
__exportStar(require("./glayoutable"), exports);
|
|
40
|
+
__exportStar(require("./gpre-rendered-element"), exports);
|
|
41
|
+
__exportStar(require("./gmodel-element"), exports);
|
|
42
|
+
__exportStar(require("./gnode"), exports);
|
|
43
|
+
__exportStar(require("./gport"), exports);
|
|
44
|
+
__exportStar(require("./gshape-element"), exports);
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,kDAAgC;AAChC,+CAA6B;AAC7B,iDAA+B;AAC/B,4CAA0B;AAC1B,iDAA+B;AAC/B,0CAAwB;AACxB,qDAAmC;AACnC,2CAAyB;AACzB,kDAAgC;AAChC,2CAAyB;AACzB,sDAAoC;AACpC,gDAA8B;AAC9B,0DAAwC;AACxC,mDAAiC;AACjC,0CAAwB;AACxB,0CAAwB;AACxB,mDAAiC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@eclipse-glsp/graph",
|
|
3
|
+
"version": "0.9.0-next.397cddd.4+397cddd",
|
|
4
|
+
"description": "The typescript implementation of the GLSP graphical model (GModel)",
|
|
5
|
+
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"eclipse",
|
|
8
|
+
"graphics",
|
|
9
|
+
"diagram",
|
|
10
|
+
"modeling",
|
|
11
|
+
"visualization",
|
|
12
|
+
"glsp",
|
|
13
|
+
"diagram editor"
|
|
14
|
+
],
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Eclipse GLSP"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://www.eclipse.org/glsp/",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/eclipse-glsp/glsp-server-node.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
|
|
24
|
+
"contributors": [
|
|
25
|
+
{
|
|
26
|
+
"name": "STMicroelectronics",
|
|
27
|
+
"url": "https://www.st.com/"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Eclipse GLSP Project",
|
|
31
|
+
"email": "glsp-dev@eclipse.org",
|
|
32
|
+
"url": "https://projects.eclipse.org/projects/ecd.glsp"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"files": [
|
|
36
|
+
"lib",
|
|
37
|
+
"src",
|
|
38
|
+
"css"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@eclipse-glsp/protocol": "next"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/uuid": "8.3.1",
|
|
45
|
+
"@types/ws": "^8.2.0",
|
|
46
|
+
"typescript": "^3.9.2"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"clean": "rimraf lib",
|
|
50
|
+
"build": "yarn run clean && tsc",
|
|
51
|
+
"test": "mocha --config ../../.mocharc.json \"./src/**/*.spec.?(ts|tsx)\"",
|
|
52
|
+
"test:ci": "export JUNIT_REPORT_PATH=./report.xml && yarn test --reporter mocha-jenkins-reporter",
|
|
53
|
+
"lint": "eslint -c ../../.eslintrc.js --ext .ts,.tsx ./src",
|
|
54
|
+
"lint:fix": "eslint --fix -c ../../.eslintrc.js --ext .ts,.tsx ./src",
|
|
55
|
+
"watch": "tsc -w"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"main": "lib/index",
|
|
61
|
+
"types": "lib/index",
|
|
62
|
+
"gitHead": "397cddd532e9596bbe3717d931ae5ca826d949dd"
|
|
63
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { DefaultTypes as types } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GButton } from './gbutton';
|
|
18
|
+
import { GCompartment } from './gcompartment';
|
|
19
|
+
import { GEdge } from './gedge';
|
|
20
|
+
import { GGraph } from './ggraph';
|
|
21
|
+
import { GIssueMarker } from './gissue-marker';
|
|
22
|
+
import { GLabel } from './glabel';
|
|
23
|
+
import { GModelElementConstructor, GModelRoot } from './gmodel-element';
|
|
24
|
+
import { GNode } from './gnode';
|
|
25
|
+
import { GPort } from './gport';
|
|
26
|
+
import { GPreRenderedElement } from './gpre-rendered-element';
|
|
27
|
+
|
|
28
|
+
export function getDefaultMapping(): Map<string, GModelElementConstructor> {
|
|
29
|
+
const mapping = new Map<string, GModelElementConstructor>();
|
|
30
|
+
mapping.set(types.GRAPH, GGraph);
|
|
31
|
+
mapping.set(types.NODE, GNode);
|
|
32
|
+
mapping.set(types.EDGE, GEdge);
|
|
33
|
+
mapping.set(types.PORT, GPort);
|
|
34
|
+
mapping.set(types.LABEL, GLabel);
|
|
35
|
+
mapping.set(types.COMPARTMENT, GCompartment);
|
|
36
|
+
mapping.set(types.COMPARTMENT_HEADER, GCompartment);
|
|
37
|
+
// TODO: mapping.set(types.BUTTON, GButton);
|
|
38
|
+
mapping.set(types.BUTTON_EXPAND, GButton);
|
|
39
|
+
mapping.set(types.ISSUE_MARKER, GIssueMarker);
|
|
40
|
+
|
|
41
|
+
mapping.set(types.NODE_CIRCLE, GNode);
|
|
42
|
+
mapping.set(types.NODE_RECTANGLE, GNode);
|
|
43
|
+
mapping.set(types.NODE_DIAMOND, GNode);
|
|
44
|
+
|
|
45
|
+
mapping.set(types.HTML, GModelRoot);
|
|
46
|
+
mapping.set(types.PRE_RENDERED, GPreRenderedElement);
|
|
47
|
+
return mapping;
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
18
|
+
|
|
19
|
+
export const GAlignable = Symbol('GAlignable');
|
|
20
|
+
|
|
21
|
+
export interface GAlignable {
|
|
22
|
+
alignment: Point;
|
|
23
|
+
[GAlignable]: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function isGAlignable<G extends GModelElement>(element: G): element is G & GAlignable {
|
|
27
|
+
return ((element as any)[GAlignable] = true);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type GAlignableBuilder<G extends GModelElement = GModelElement> = GModelElementBuilder<G & GAlignable>;
|
|
31
|
+
|
|
32
|
+
export namespace GAlignableBuilder {
|
|
33
|
+
export function alignment<B extends GAlignableBuilder>(builder: B, pointOrX: Point | number, y?: number): B {
|
|
34
|
+
const proxy = builder['proxy'];
|
|
35
|
+
if (typeof pointOrX === 'object') {
|
|
36
|
+
proxy.alignment = pointOrX;
|
|
37
|
+
} else if (y) {
|
|
38
|
+
proxy.alignment = { x: pointOrX, y };
|
|
39
|
+
}
|
|
40
|
+
return builder;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { Dimension, Point } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
18
|
+
|
|
19
|
+
export const GBoundsAware = Symbol('GBoundsAware');
|
|
20
|
+
|
|
21
|
+
export interface GBoundsAware {
|
|
22
|
+
position?: Point;
|
|
23
|
+
size?: Dimension;
|
|
24
|
+
[GBoundsAware]: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isGBoundsAware<G extends GModelElement>(element: G): element is G & GBoundsAware {
|
|
28
|
+
return ((element as any)[GBoundsAware] = true);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type GBoundsAwareBuilder<G extends GModelElement = GModelElement> = GModelElementBuilder<G & GBoundsAware>;
|
|
32
|
+
|
|
33
|
+
export namespace GBoundsAwareBuilder {
|
|
34
|
+
export function position<B extends GBoundsAwareBuilder>(builder: B, pointOrX: Point | number, y?: number): B {
|
|
35
|
+
const proxy = builder['proxy'];
|
|
36
|
+
if (typeof pointOrX === 'object') {
|
|
37
|
+
proxy.position = pointOrX;
|
|
38
|
+
} else if (y) {
|
|
39
|
+
proxy.position = { x: pointOrX, y };
|
|
40
|
+
}
|
|
41
|
+
return builder;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function size<B extends GBoundsAwareBuilder>(builder: B, sizeOrWidth: Dimension | number, height?: number): B {
|
|
45
|
+
const proxy = builder['proxy'];
|
|
46
|
+
if (typeof sizeOrWidth === 'object') {
|
|
47
|
+
proxy.size = sizeOrWidth;
|
|
48
|
+
} else if (height) {
|
|
49
|
+
proxy.size = { width: sizeOrWidth, height };
|
|
50
|
+
}
|
|
51
|
+
return builder;
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/gbutton.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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 { DefaultTypes } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GModelElementConstructor } from './gmodel-element';
|
|
18
|
+
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
19
|
+
|
|
20
|
+
export class GButton extends GShapeElement {
|
|
21
|
+
static builder<G extends GButton = GButton>(constructor?: GModelElementConstructor<G>): GButtonBuilder {
|
|
22
|
+
return new GButtonBuilder(constructor ?? GButton).type(DefaultTypes.BUTTON_EXPAND);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type = DefaultTypes.BUTTON_EXPAND;
|
|
26
|
+
enabled = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class GButtonBuilder<G extends GButton = GButton> extends GShapeElementBuilder<G> {
|
|
30
|
+
enabled(enabled: boolean): this {
|
|
31
|
+
this.proxy.enabled = enabled;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
}
|