@eclipse-glsp/graph 1.1.0-next.28838fb.26 → 1.1.0-next.2ae7567.68
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/lib/default-types.d.ts.map +1 -1
- package/lib/default-types.js +7 -4
- package/lib/default-types.js.map +1 -1
- package/lib/galignable.d.ts +2 -2
- package/lib/galignable.d.ts.map +1 -1
- package/lib/galignable.js +2 -2
- package/lib/galignable.js.map +1 -1
- package/lib/{gbound-aware.d.ts → gbounds-aware.d.ts} +3 -3
- package/lib/gbounds-aware.d.ts.map +1 -0
- package/lib/{gbound-aware.js → gbounds-aware.js} +3 -3
- package/lib/gbounds-aware.js.map +1 -0
- package/lib/gcompartment.d.ts +3 -25
- package/lib/gcompartment.d.ts.map +1 -1
- package/lib/gcompartment.js +4 -12
- package/lib/gcompartment.js.map +1 -1
- package/lib/gedge-layoutable.d.ts +6 -6
- package/lib/gedge-layoutable.d.ts.map +1 -1
- package/lib/gedge-layoutable.js +3 -6
- package/lib/gedge-layoutable.js.map +1 -1
- package/lib/gedge.js +1 -1
- package/lib/gedge.js.map +1 -1
- package/lib/gforeign-object-element.d.ts +35 -0
- package/lib/gforeign-object-element.d.ts.map +1 -0
- package/lib/gforeign-object-element.js +44 -0
- package/lib/gforeign-object-element.js.map +1 -0
- package/lib/ggraph.d.ts +9 -3
- package/lib/ggraph.d.ts.map +1 -1
- package/lib/ggraph.js +13 -5
- package/lib/ggraph.js.map +1 -1
- package/lib/ghtml-root.d.ts +14 -0
- package/lib/ghtml-root.d.ts.map +1 -0
- package/lib/ghtml-root.js +42 -0
- package/lib/ghtml-root.js.map +1 -0
- package/lib/gissue-marker.d.ts +2 -1
- package/lib/gissue-marker.d.ts.map +1 -1
- package/lib/gissue-marker.js +3 -0
- package/lib/gissue-marker.js.map +1 -1
- package/lib/glabel.d.ts +3 -3
- package/lib/glabel.d.ts.map +1 -1
- package/lib/glabel.js.map +1 -1
- package/lib/glayoutable.d.ts +2 -2
- package/lib/glayoutable.d.ts.map +1 -1
- package/lib/glayoutable.js +2 -2
- package/lib/glayoutable.js.map +1 -1
- package/lib/{glayout-container.d.ts → glayouting.d.ts} +9 -9
- package/lib/glayouting.d.ts.map +1 -0
- package/lib/glayouting.js +17 -0
- package/lib/glayouting.js.map +1 -0
- package/lib/gmodel-element.d.ts +6 -18
- package/lib/gmodel-element.d.ts.map +1 -1
- package/lib/gmodel-element.js +3 -15
- package/lib/gmodel-element.js.map +1 -1
- package/lib/gmodel-util.d.ts +3 -3
- package/lib/gmodel-util.d.ts.map +1 -1
- package/lib/gmodel-util.js +1 -1
- package/lib/gnode.d.ts +7 -3
- package/lib/gnode.d.ts.map +1 -1
- package/lib/gnode.js +9 -4
- package/lib/gnode.js.map +1 -1
- package/lib/gshape-element.d.ts +1 -1
- package/lib/gshape-element.d.ts.map +1 -1
- package/lib/gshape-element.js +4 -4
- package/lib/gshape-element.js.map +1 -1
- package/lib/{gpre-shape-prerendered-element.d.ts → gshaped-prerendered-element.d.ts} +6 -6
- package/lib/gshaped-prerendered-element.d.ts.map +1 -0
- package/lib/{gpre-shape-prerendered-element.js → gshaped-prerendered-element.js} +9 -9
- package/lib/gshaped-prerendered-element.js.map +1 -0
- package/lib/index.d.ts +5 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -4
- package/lib/index.js.map +1 -1
- package/{src/gmodel-element.spec.ts → lib/index.spec.d.ts} +1 -3
- package/lib/index.spec.d.ts.map +1 -0
- package/lib/index.spec.js +27 -0
- package/lib/index.spec.js.map +1 -0
- package/package.json +22 -21
- package/src/default-types.ts +8 -4
- package/src/galignable.ts +2 -2
- package/src/{gbound-aware.ts → gbounds-aware.ts} +2 -2
- package/src/gcompartment.ts +5 -18
- package/src/gedge-layoutable.ts +5 -5
- package/src/gforeign-object-element.ts +44 -0
- package/src/ggraph.ts +16 -3
- package/src/ghtml-root.ts +38 -0
- package/src/gissue-marker.ts +4 -0
- package/src/glabel.ts +3 -3
- package/src/glayoutable.ts +2 -2
- package/src/{glayout-container.ts → glayouting.ts} +9 -9
- package/src/gmodel-element.ts +7 -21
- package/src/gmodel-util.ts +2 -2
- package/src/gnode.ts +11 -4
- package/src/gshape-element.ts +1 -1
- package/src/{gpre-shape-prerendered-element.ts → gshaped-prerendered-element.ts} +6 -6
- package/src/index.spec.ts +27 -0
- package/src/index.ts +5 -3
- package/lib/gbound-aware.d.ts.map +0 -1
- package/lib/gbound-aware.js.map +0 -1
- package/lib/glayout-container.d.ts.map +0 -1
- package/lib/glayout-container.js +0 -17
- package/lib/glayout-container.js.map +0 -1
- package/lib/gpre-shape-prerendered-element.d.ts.map +0 -1
- package/lib/gpre-shape-prerendered-element.js.map +0 -1
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,kDAAgC;AAChC,+CAA6B;AAC7B,kDAAgC;AAChC,4CAA0B;AAC1B,iDAA+B;AAC/B,0CAAwB;AACxB,qDAAmC;AACnC,4DAA0C;AAC1C,2CAAyB;AACzB,+CAA6B;AAC7B,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,gDAA8B;AAC9B,0CAAwB;AACxB,0CAAwB;AACxB,0DAAwC;AACxC,mDAAiC;AACjC,gEAA8C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/* note: this bogus test file is required so that
|
|
18
|
+
we are able to run mocha unit tests on this
|
|
19
|
+
package, without having any actual unit tests in it.
|
|
20
|
+
This way a coverage report will be generated,
|
|
21
|
+
showing 0% coverage, instead of no report.
|
|
22
|
+
This file can be removed once we have real unit
|
|
23
|
+
tests in place. */
|
|
24
|
+
describe('graph package', () => {
|
|
25
|
+
it('should support code coverage statistics', () => true);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;AAElF;;;;;;qBAMqB;AAErB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/graph",
|
|
3
|
-
"version": "1.1.0-next.
|
|
3
|
+
"version": "1.1.0-next.2ae7567.68+2ae7567",
|
|
4
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
5
|
"keywords": [
|
|
7
6
|
"eclipse",
|
|
8
7
|
"graphics",
|
|
@@ -12,15 +11,16 @@
|
|
|
12
11
|
"glsp",
|
|
13
12
|
"diagram editor"
|
|
14
13
|
],
|
|
15
|
-
"author": {
|
|
16
|
-
"name": "Eclipse GLSP"
|
|
17
|
-
},
|
|
18
14
|
"homepage": "https://www.eclipse.org/glsp/",
|
|
15
|
+
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
|
|
19
16
|
"repository": {
|
|
20
17
|
"type": "git",
|
|
21
18
|
"url": "https://github.com/eclipse-glsp/glsp-server-node.git"
|
|
22
19
|
},
|
|
23
|
-
"
|
|
20
|
+
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Eclipse GLSP"
|
|
23
|
+
},
|
|
24
24
|
"contributors": [
|
|
25
25
|
{
|
|
26
26
|
"name": "STMicroelectronics",
|
|
@@ -32,30 +32,31 @@
|
|
|
32
32
|
"url": "https://projects.eclipse.org/projects/ecd.glsp"
|
|
33
33
|
}
|
|
34
34
|
],
|
|
35
|
+
"main": "lib/index",
|
|
36
|
+
"types": "lib/index",
|
|
35
37
|
"files": [
|
|
36
38
|
"lib",
|
|
37
|
-
"src"
|
|
38
|
-
"css"
|
|
39
|
+
"src"
|
|
39
40
|
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -b",
|
|
43
|
+
"clean": "rimraf lib tsconfig.tsbuildinfo coverage .nyc_output",
|
|
44
|
+
"lint": "eslint --ext .ts,.tsx ./src",
|
|
45
|
+
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
|
|
46
|
+
"prepare": "yarn clean && yarn build",
|
|
47
|
+
"test": "mocha --config ../../.mocharc \"./src/**/*.spec.?(ts|tsx)\"",
|
|
48
|
+
"test:ci": "export JUNIT_REPORT_PATH=./report.xml && yarn test --reporter mocha-jenkins-reporter",
|
|
49
|
+
"test:coverage": "nyc yarn test",
|
|
50
|
+
"watch": "tsc -w"
|
|
51
|
+
},
|
|
40
52
|
"dependencies": {
|
|
41
|
-
"@eclipse-glsp/protocol": "
|
|
53
|
+
"@eclipse-glsp/protocol": "next"
|
|
42
54
|
},
|
|
43
55
|
"devDependencies": {
|
|
44
56
|
"@types/uuid": "8.3.1"
|
|
45
57
|
},
|
|
46
|
-
"scripts": {
|
|
47
|
-
"clean": "rimraf tsconfig.tsbuildinfo lib",
|
|
48
|
-
"build": "yarn run clean && tsc",
|
|
49
|
-
"test": "mocha --config ../../.mocharc.json \"./src/**/*.spec.?(ts|tsx)\"",
|
|
50
|
-
"test:ci": "export JUNIT_REPORT_PATH=./report.xml && yarn test --reporter mocha-jenkins-reporter",
|
|
51
|
-
"lint": "eslint -c ../../.eslintrc.js --ext .ts,.tsx ./src",
|
|
52
|
-
"lint:fix": "eslint --fix -c ../../.eslintrc.js --ext .ts,.tsx ./src",
|
|
53
|
-
"watch": "tsc -w"
|
|
54
|
-
},
|
|
55
58
|
"publishConfig": {
|
|
56
59
|
"access": "public"
|
|
57
60
|
},
|
|
58
|
-
"
|
|
59
|
-
"types": "lib/index",
|
|
60
|
-
"gitHead": "28838fbebe8da8b6c32f55f80ac08a83842f376c"
|
|
61
|
+
"gitHead": "2ae75670d3253d7d7e777c0941541411fba8bec6"
|
|
61
62
|
}
|
package/src/default-types.ts
CHANGED
|
@@ -18,15 +18,19 @@ import { GButton } from './gbutton';
|
|
|
18
18
|
import { GCompartment } from './gcompartment';
|
|
19
19
|
import { GEdge } from './gedge';
|
|
20
20
|
import { GGraph } from './ggraph';
|
|
21
|
+
import { GHtmlRoot } from './ghtml-root';
|
|
21
22
|
import { GIssueMarker } from './gissue-marker';
|
|
22
23
|
import { GLabel } from './glabel';
|
|
23
|
-
import { GModelElementConstructor
|
|
24
|
+
import { GModelElementConstructor } from './gmodel-element';
|
|
24
25
|
import { GNode } from './gnode';
|
|
25
26
|
import { GPort } from './gport';
|
|
26
27
|
import { GPreRenderedElement } from './gpre-rendered-element';
|
|
27
|
-
import {
|
|
28
|
+
import { GShapedPreRenderedElement } from './gshaped-prerendered-element';
|
|
28
29
|
|
|
29
30
|
export function getDefaultMapping(): Map<string, GModelElementConstructor> {
|
|
31
|
+
// The GModelSerializer (packages/server-node/src/features/model/gmodel-serializer.ts)
|
|
32
|
+
// has a built-in subtype handling.
|
|
33
|
+
// If the mapping for a subtype, e.g. for comp:header, is not found it will use the mapping for comp instead.
|
|
30
34
|
const mapping = new Map<string, GModelElementConstructor>();
|
|
31
35
|
mapping.set(types.GRAPH, GGraph);
|
|
32
36
|
mapping.set(types.NODE, GNode);
|
|
@@ -37,8 +41,8 @@ export function getDefaultMapping(): Map<string, GModelElementConstructor> {
|
|
|
37
41
|
mapping.set(types.BUTTON, GButton);
|
|
38
42
|
mapping.set(types.ISSUE_MARKER, GIssueMarker);
|
|
39
43
|
|
|
40
|
-
mapping.set(types.HTML,
|
|
44
|
+
mapping.set(types.HTML, GHtmlRoot);
|
|
41
45
|
mapping.set(types.PRE_RENDERED, GPreRenderedElement);
|
|
42
|
-
mapping.set(types.FOREIGN_OBJECT,
|
|
46
|
+
mapping.set(types.FOREIGN_OBJECT, GShapedPreRenderedElement);
|
|
43
47
|
return mapping;
|
|
44
48
|
}
|
package/src/galignable.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -24,7 +24,7 @@ export interface GAlignable {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function isGAlignable<G extends GModelElement>(element: G): element is G & GAlignable {
|
|
27
|
-
return
|
|
27
|
+
return GAlignable in element && element[GAlignable] === true;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export type GAlignableBuilder<G extends GModelElement = GModelElement> = GModelElementBuilder<G & GAlignable>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,7 +25,7 @@ export interface GBoundsAware {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function isGBoundsAware<G extends GModelElement>(element: G): element is G & GBoundsAware {
|
|
28
|
-
return
|
|
28
|
+
return GBoundsAware in element && element[GBoundsAware] === true;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export type GBoundsAwareBuilder<G extends GModelElement = GModelElement> = GModelElementBuilder<G & GBoundsAware>;
|
package/src/gcompartment.ts
CHANGED
|
@@ -13,35 +13,22 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { GLayoutable, GLayoutableBuilder } from './glayoutable';
|
|
16
|
+
import { DefaultTypes } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GLayouting, GLayoutingBuilder } from './glayouting';
|
|
19
18
|
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
20
19
|
|
|
21
|
-
export class GCompartment extends GShapeElement implements
|
|
20
|
+
export class GCompartment extends GShapeElement implements GLayouting {
|
|
22
21
|
static builder(): GCompartmentBuilder {
|
|
23
22
|
return new GCompartmentBuilder(GCompartment).type(DefaultTypes.COMPARTMENT);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
override type = DefaultTypes.COMPARTMENT;
|
|
27
26
|
layout?: string;
|
|
28
|
-
|
|
29
|
-
[GLayoutContainer] = true;
|
|
30
|
-
[GLayoutable] = true;
|
|
27
|
+
[GLayouting] = true;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
export class GCompartmentBuilder<G extends GCompartment = GCompartment> extends GShapeElementBuilder<G> {
|
|
34
31
|
layout(layout?: string): this {
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
override addLayoutOption(key: string, value: JsonPrimitive): this {
|
|
39
|
-
return GLayoutableBuilder.addLayoutOption(this, key, value);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
override addLayoutOptions(layoutOptions: Args): this;
|
|
43
|
-
override addLayoutOptions(layoutOptions: Map<string, JsonPrimitive>): this;
|
|
44
|
-
override addLayoutOptions(layoutOptions: Args | Map<string, JsonPrimitive>): this {
|
|
45
|
-
return GLayoutableBuilder.addLayoutOptions(this, layoutOptions);
|
|
32
|
+
return GLayoutingBuilder.layout(this, layout);
|
|
46
33
|
}
|
|
47
34
|
}
|
package/src/gedge-layoutable.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -17,7 +17,7 @@ import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
|
17
17
|
|
|
18
18
|
export type EdgeSide = 'left' | 'right' | 'top' | 'bottom' | 'on';
|
|
19
19
|
|
|
20
|
-
export
|
|
20
|
+
export interface GEdgePlacement {
|
|
21
21
|
rotate: boolean;
|
|
22
22
|
side: EdgeSide;
|
|
23
23
|
position: number;
|
|
@@ -27,18 +27,18 @@ export class EdgePlacement extends Object {
|
|
|
27
27
|
export const GEdgeLayoutable = Symbol('GEdgeLayoutable');
|
|
28
28
|
|
|
29
29
|
export interface GEdgeLayoutable {
|
|
30
|
-
edgePlacement?:
|
|
30
|
+
edgePlacement?: GEdgePlacement;
|
|
31
31
|
[GEdgeLayoutable]: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function isGEdgeLayoutable<G extends GModelElement>(element: G): element is G & GEdgeLayoutable {
|
|
35
|
-
return
|
|
35
|
+
return GEdgeLayoutable in element && element[GEdgeLayoutable] === true;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export type GEdgeLayoutableBuilder<G extends GModelElement = GModelElement> = GModelElementBuilder<G & GEdgeLayoutable>;
|
|
39
39
|
|
|
40
40
|
export namespace GEdgeLayoutableBuilder {
|
|
41
|
-
export function edgePlacement<B extends GEdgeLayoutableBuilder>(builder: B, placement?:
|
|
41
|
+
export function edgePlacement<B extends GEdgeLayoutableBuilder>(builder: B, placement?: GEdgePlacement): B {
|
|
42
42
|
builder['proxy'].edgePlacement = placement;
|
|
43
43
|
return builder;
|
|
44
44
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { GShapePreRenderedElementBuilder, GShapedPreRenderedElement } from './gshaped-prerendered-element';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A `foreignObject` element to be transferred to the DOM within the SVG.
|
|
21
|
+
*
|
|
22
|
+
* This can be useful to to benefit from e.g. HTML rendering features, such as line wrapping, inside of
|
|
23
|
+
* the SVG diagram. Note that `foreignObject` is not supported by all browsers and SVG viewers may not
|
|
24
|
+
* support rendering the `foreignObject` content.
|
|
25
|
+
*
|
|
26
|
+
* If no dimensions are specified in the schema element, this element will obtain the dimension of
|
|
27
|
+
* its parent to fill the entire available room. Thus, this element requires specified bounds itself
|
|
28
|
+
* or bounds to be available for its parent.
|
|
29
|
+
*/
|
|
30
|
+
export class GForeignObjectElement extends GShapedPreRenderedElement {
|
|
31
|
+
static override builder(): GForeignObjectElementBuilder {
|
|
32
|
+
return new GForeignObjectElementBuilder(GForeignObjectElement);
|
|
33
|
+
}
|
|
34
|
+
namespace: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class GForeignObjectElementBuilder<
|
|
38
|
+
G extends GForeignObjectElement = GForeignObjectElement
|
|
39
|
+
> extends GShapePreRenderedElementBuilder<G> {
|
|
40
|
+
namespace(namespace: string): this {
|
|
41
|
+
this.proxy.namespace = namespace;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/ggraph.ts
CHANGED
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
* Parts of the implementation is derived from Sprotty's SModel API
|
|
20
20
|
* (https://github.com/eclipse/sprotty/blob/master/packages/sprotty/src/base/model/smodel.ts)
|
|
21
21
|
*/
|
|
22
|
-
import { DefaultTypes as types, Dimension, Point } from '@eclipse-glsp/protocol';
|
|
23
|
-
import { GBoundsAware, GBoundsAwareBuilder } from './
|
|
22
|
+
import { Args, DefaultTypes as types, Dimension, JsonPrimitive, Point } from '@eclipse-glsp/protocol';
|
|
23
|
+
import { GBoundsAware, GBoundsAwareBuilder } from './gbounds-aware';
|
|
24
|
+
import { GLayoutable, GLayoutableBuilder } from './glayoutable';
|
|
24
25
|
import { GModelRoot, GModelRootBuilder } from './gmodel-element';
|
|
25
26
|
|
|
26
|
-
export class GGraph extends GModelRoot implements GBoundsAware {
|
|
27
|
+
export class GGraph extends GModelRoot implements GBoundsAware, GLayoutable {
|
|
27
28
|
static override builder(): GGraphBuilder {
|
|
28
29
|
return new GGraphBuilder(GGraph);
|
|
29
30
|
}
|
|
@@ -31,7 +32,9 @@ export class GGraph extends GModelRoot implements GBoundsAware {
|
|
|
31
32
|
override type = types.GRAPH;
|
|
32
33
|
position: Point = Point.ORIGIN;
|
|
33
34
|
size?: Dimension;
|
|
35
|
+
layoutOptions?: Args;
|
|
34
36
|
[GBoundsAware] = true;
|
|
37
|
+
[GLayoutable] = true;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
export class GGraphBuilder<G extends GGraph = GGraph> extends GModelRootBuilder<G> {
|
|
@@ -46,4 +49,14 @@ export class GGraphBuilder<G extends GGraph = GGraph> extends GModelRootBuilder<
|
|
|
46
49
|
size(sizeOrWidth: Dimension | number, height?: number): this {
|
|
47
50
|
return GBoundsAwareBuilder.size(this, sizeOrWidth, height);
|
|
48
51
|
}
|
|
52
|
+
|
|
53
|
+
addLayoutOption(key: string, value: JsonPrimitive): this {
|
|
54
|
+
return GLayoutableBuilder.addLayoutOption(this, key, value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
addLayoutOptions(layoutOptions: Args): this;
|
|
58
|
+
addLayoutOptions(layoutOptions: Map<string, JsonPrimitive>): this;
|
|
59
|
+
addLayoutOptions(layoutOptions: Args | Map<string, JsonPrimitive>): this {
|
|
60
|
+
return GLayoutableBuilder.addLayoutOptions(this, layoutOptions);
|
|
61
|
+
}
|
|
49
62
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 StMicroelectronics.
|
|
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, flatPush, MaybeArray } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { GModelRoot, GModelRootBuilder } from './gmodel-element';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Root model element class for HTML content. Usually this is rendered with a `div` DOM element.
|
|
21
|
+
*/
|
|
22
|
+
export class GHtmlRoot extends GModelRoot {
|
|
23
|
+
static override builder(): GHtmlRootBuilder {
|
|
24
|
+
return new GHtmlRootBuilder(GHtmlRoot);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override type = types.HTML;
|
|
28
|
+
classes: string[] = [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class GHtmlRootBuilder<G extends GHtmlRoot = GHtmlRoot> extends GModelRootBuilder<G> {
|
|
32
|
+
addClasses(classes: string[]): this;
|
|
33
|
+
addClasses(...classes: string[]): this;
|
|
34
|
+
addClasses(...classes: MaybeArray<string>[]): this {
|
|
35
|
+
flatPush(this.proxy.classes, classes);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/gissue-marker.ts
CHANGED
|
@@ -24,6 +24,10 @@ export class GIssue {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export class GIssueMarker extends GShapeElement {
|
|
27
|
+
static builder(): GIssueMarkerBuilder {
|
|
28
|
+
return new GIssueMarkerBuilder(GIssueMarker).type(DefaultTypes.ISSUE_MARKER);
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
override type = DefaultTypes.ISSUE_MARKER;
|
|
28
32
|
issues: GIssue[] = [];
|
|
29
33
|
}
|
package/src/glabel.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { DefaultTypes, Point } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { GAlignable, GAlignableBuilder } from './galignable';
|
|
18
|
-
import {
|
|
18
|
+
import { GEdgeLayoutable, GEdgeLayoutableBuilder, GEdgePlacement } from './gedge-layoutable';
|
|
19
19
|
import { GModelElementConstructor } from './gmodel-element';
|
|
20
20
|
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
21
21
|
|
|
@@ -27,7 +27,7 @@ export class GLabel extends GShapeElement implements GAlignable, GEdgeLayoutable
|
|
|
27
27
|
override type = DefaultTypes.LABEL;
|
|
28
28
|
text: string;
|
|
29
29
|
alignment: Point = Point.ORIGIN;
|
|
30
|
-
edgePlacement?:
|
|
30
|
+
edgePlacement?: GEdgePlacement;
|
|
31
31
|
[GAlignable] = true;
|
|
32
32
|
[GEdgeLayoutable] = true;
|
|
33
33
|
}
|
|
@@ -44,7 +44,7 @@ export class GLabelBuilder<G extends GLabel = GLabel> extends GShapeElementBuild
|
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
edgePlacement(placement:
|
|
47
|
+
edgePlacement(placement: GEdgePlacement): this {
|
|
48
48
|
return GEdgeLayoutableBuilder.edgePlacement(this, placement);
|
|
49
49
|
}
|
|
50
50
|
}
|
package/src/glayoutable.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -24,7 +24,7 @@ export interface GLayoutable {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function isGLayoutable<G extends GModelElement>(element: G): element is G & GLayoutable {
|
|
27
|
-
return
|
|
27
|
+
return GLayoutable in element && element[GLayoutable] === true;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export type GLayoutableBuilder = GModelElementBuilder<GModelElement & GLayoutable>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const GLayouting = Symbol('GLayouting');
|
|
19
19
|
|
|
20
|
-
export interface
|
|
20
|
+
export interface GLayouting {
|
|
21
21
|
layout?: string;
|
|
22
|
-
[
|
|
22
|
+
[GLayouting]: boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function
|
|
26
|
-
return
|
|
25
|
+
export function isGLayouting<G extends GModelElement>(element: G): element is G & GLayouting {
|
|
26
|
+
return GLayouting in element && element[GLayouting] === true;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export type
|
|
29
|
+
export type GLayoutingBuilder = GModelElementBuilder<GModelElement & GLayouting>;
|
|
30
30
|
|
|
31
|
-
export namespace
|
|
32
|
-
export function layout<B extends
|
|
31
|
+
export namespace GLayoutingBuilder {
|
|
32
|
+
export function layout<B extends GLayoutingBuilder>(builder: B, newLayout?: string): B {
|
|
33
33
|
builder['proxy'].layout = newLayout;
|
|
34
34
|
return builder;
|
|
35
35
|
}
|
package/src/gmodel-element.ts
CHANGED
|
@@ -17,29 +17,16 @@ import {
|
|
|
17
17
|
Args,
|
|
18
18
|
Bounds,
|
|
19
19
|
Dimension,
|
|
20
|
-
|
|
20
|
+
GModelElementSchema,
|
|
21
|
+
GModelRootSchema,
|
|
21
22
|
JsonPrimitive,
|
|
22
23
|
MaybeArray,
|
|
23
24
|
Point,
|
|
24
|
-
|
|
25
|
-
SModelRootSchema
|
|
25
|
+
flatPush
|
|
26
26
|
} from '@eclipse-glsp/protocol';
|
|
27
27
|
import * as uuid from 'uuid';
|
|
28
28
|
|
|
29
29
|
export type GModelElementConstructor<G extends GModelElement = GModelElement> = new () => G;
|
|
30
|
-
/**
|
|
31
|
-
* Represents a `GModeElement` serialized as plain JSON object.
|
|
32
|
-
*/
|
|
33
|
-
export type GModelElementSchema = SModelElementSchema;
|
|
34
|
-
|
|
35
|
-
export namespace GModelElementSchema {
|
|
36
|
-
/**
|
|
37
|
-
* Typeguard function to check wether the given object is an {@link GModelElementSchema}.
|
|
38
|
-
* @param object The object to check.
|
|
39
|
-
* @returns A type literal indicating wether the given object is of type {@link GModelElementSchema}.
|
|
40
|
-
*/
|
|
41
|
-
export const is = SModelElementSchema.is;
|
|
42
|
-
}
|
|
43
30
|
|
|
44
31
|
/**
|
|
45
32
|
* Base type for all elements of the graphical model.
|
|
@@ -63,7 +50,8 @@ export abstract class GModelElement implements GModelElementSchema {
|
|
|
63
50
|
* A set of css classes that should be applied to the DOM element that corresponds to this element.
|
|
64
51
|
*/
|
|
65
52
|
cssClasses: string[] = [];
|
|
66
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
|
|
67
55
|
* the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
|
|
68
56
|
* of the DOM element that reflects this element.
|
|
69
57
|
*/
|
|
@@ -186,15 +174,13 @@ export abstract class GModelElementBuilder<G extends GModelElement> {
|
|
|
186
174
|
}
|
|
187
175
|
}
|
|
188
176
|
|
|
189
|
-
export
|
|
190
|
-
|
|
191
|
-
export class GModelRoot extends GModelElement implements SModelRootSchema {
|
|
177
|
+
export class GModelRoot extends GModelElement implements GModelRootSchema {
|
|
192
178
|
static builder(): GModelRootBuilder {
|
|
193
179
|
return new GModelRootBuilder(GModelRoot);
|
|
194
180
|
}
|
|
195
181
|
|
|
196
182
|
canvasBounds?: Bounds;
|
|
197
|
-
revision
|
|
183
|
+
revision?: number;
|
|
198
184
|
}
|
|
199
185
|
|
|
200
186
|
export class GModelRootBuilder<G extends GModelRoot = GModelRoot> extends GModelElementBuilder<G> {
|
package/src/gmodel-util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { GModelElement, GModelElementConstructor } from '
|
|
17
|
+
import { GModelElement, GModelElementConstructor } from './gmodel-element';
|
|
18
18
|
|
|
19
19
|
export type Predicate<T> = (element: T) => boolean;
|
|
20
20
|
|
package/src/gnode.ts
CHANGED
|
@@ -14,21 +14,28 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { DefaultTypes } from '@eclipse-glsp/protocol';
|
|
17
|
-
import {
|
|
17
|
+
import { GEdgeLayoutable, GEdgeLayoutableBuilder, GEdgePlacement } from './gedge-layoutable';
|
|
18
|
+
import { GLayouting, GLayoutingBuilder } from './glayouting';
|
|
18
19
|
import { GShapeElement, GShapeElementBuilder } from './gshape-element';
|
|
19
20
|
|
|
20
|
-
export class GNode extends GShapeElement implements
|
|
21
|
+
export class GNode extends GShapeElement implements GEdgeLayoutable, GLayouting {
|
|
21
22
|
static builder(): GNodeBuilder {
|
|
22
23
|
return new GNodeBuilder(GNode).type(DefaultTypes.NODE);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
override type = DefaultTypes.NODE;
|
|
27
|
+
edgePlacement?: GEdgePlacement;
|
|
26
28
|
layout?: string;
|
|
27
|
-
[
|
|
29
|
+
[GEdgeLayoutable] = true;
|
|
30
|
+
[GLayouting] = true;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
export class GNodeBuilder<G extends GNode = GNode> extends GShapeElementBuilder<G> {
|
|
34
|
+
edgePlacement(placement: GEdgePlacement): this {
|
|
35
|
+
return GEdgeLayoutableBuilder.edgePlacement(this, placement);
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
layout(layout?: string): this {
|
|
32
|
-
return
|
|
39
|
+
return GLayoutingBuilder.layout(this, layout);
|
|
33
40
|
}
|
|
34
41
|
}
|
package/src/gshape-element.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Args, Dimension, JsonPrimitive, Point } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { GBoundsAware, GBoundsAwareBuilder } from './
|
|
17
|
+
import { GBoundsAware, GBoundsAwareBuilder } from './gbounds-aware';
|
|
18
18
|
import { GLayoutable, GLayoutableBuilder } from './glayoutable';
|
|
19
19
|
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
20
20
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { Dimension, Point } from '@eclipse-glsp/protocol';
|
|
18
18
|
import { GAlignable } from './galignable';
|
|
19
|
-
import { GBoundsAware, GBoundsAwareBuilder } from './
|
|
19
|
+
import { GBoundsAware, GBoundsAwareBuilder } from './gbounds-aware';
|
|
20
20
|
import { GModelElementBuilder } from './gmodel-element';
|
|
21
21
|
import { GPreRenderedElement } from './gpre-rendered-element';
|
|
22
22
|
|
|
@@ -27,20 +27,20 @@ import { GPreRenderedElement } from './gpre-rendered-element';
|
|
|
27
27
|
* A popup model is rendered when hovering over a element and for many common use cases e.g rendering a tooltip
|
|
28
28
|
* this model can be computed entirely on the server side.
|
|
29
29
|
*/
|
|
30
|
-
export class
|
|
30
|
+
export class GShapedPreRenderedElement extends GPreRenderedElement implements GBoundsAware, GAlignable {
|
|
31
31
|
static override builder(): GShapePreRenderedElementBuilder {
|
|
32
|
-
return new GShapePreRenderedElementBuilder(
|
|
32
|
+
return new GShapePreRenderedElementBuilder(GShapedPreRenderedElement);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
[GBoundsAware] = true;
|
|
36
|
-
[GAlignable] = true;
|
|
37
35
|
position: Point;
|
|
38
36
|
size: Dimension;
|
|
39
37
|
alignment: Point;
|
|
38
|
+
[GBoundsAware] = true;
|
|
39
|
+
[GAlignable] = true;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export class GShapePreRenderedElementBuilder<
|
|
43
|
-
G extends
|
|
43
|
+
G extends GShapedPreRenderedElement = GShapedPreRenderedElement
|
|
44
44
|
> extends GModelElementBuilder<G> {
|
|
45
45
|
code(code: string): this {
|
|
46
46
|
this.proxy.code = code;
|