@eclipse-glsp/graph 0.9.0-next.fc2c95e.5 → 1.1.0-RC02
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 +8 -8
- package/lib/default-types.js.map +1 -1
- package/lib/{gbound-aware.d.ts → gbounds-aware.d.ts} +1 -1
- package/lib/gbounds-aware.d.ts.map +1 -0
- package/lib/{gbound-aware.js → gbounds-aware.js} +1 -1
- package/lib/gbounds-aware.js.map +1 -0
- package/lib/gbutton.d.ts.map +1 -1
- package/lib/gbutton.js.map +1 -1
- 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 +3 -3
- package/lib/gedge-layoutable.d.ts.map +1 -1
- package/lib/gedge-layoutable.js +1 -4
- package/lib/gedge-layoutable.js.map +1 -1
- package/lib/gedge.d.ts.map +1 -1
- package/lib/gedge.js +1 -1
- package/lib/gedge.js.map +1 -1
- package/lib/ggraph.d.ts +9 -3
- package/lib/ggraph.d.ts.map +1 -1
- package/lib/ggraph.js +14 -6
- package/lib/ggraph.js.map +1 -1
- package/lib/ghtmlroot.d.ts +14 -0
- package/lib/ghtmlroot.d.ts.map +1 -0
- package/lib/ghtmlroot.js +42 -0
- package/lib/ghtmlroot.js.map +1 -0
- package/lib/gissue-marker.d.ts +1 -0
- package/lib/gissue-marker.d.ts.map +1 -1
- package/lib/gissue-marker.js +4 -1
- 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 +1 -1
- package/lib/glabel.js.map +1 -1
- package/lib/{glayout-container.d.ts → glayouting.d.ts} +8 -8
- 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 +11 -4
- package/lib/gmodel-element.d.ts.map +1 -1
- package/lib/gmodel-element.js +14 -16
- package/lib/gmodel-element.js.map +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/gport.d.ts.map +1 -1
- package/lib/gport.js.map +1 -1
- package/lib/gpre-rendered-element.d.ts.map +1 -1
- package/lib/gpre-rendered-element.js +1 -1
- package/lib/gpre-rendered-element.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/gshaped-prerendered-element.d.ts +43 -0
- package/lib/gshaped-prerendered-element.d.ts.map +1 -0
- package/lib/gshaped-prerendered-element.js +56 -0
- package/lib/gshaped-prerendered-element.js.map +1 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -3
- package/lib/index.js.map +1 -1
- package/package.json +9 -10
- package/src/default-types.ts +9 -9
- package/src/{gbound-aware.ts → gbounds-aware.ts} +0 -0
- package/src/gbutton.ts +1 -1
- package/src/gcompartment.ts +6 -19
- package/src/gedge-layoutable.ts +3 -3
- package/src/gedge.ts +1 -1
- package/src/ggraph.ts +19 -6
- package/src/ghtmlroot.ts +38 -0
- package/src/gissue-marker.ts +5 -1
- package/src/glabel.ts +6 -6
- package/src/{glayout-container.ts → glayouting.ts} +8 -8
- package/src/gmodel-element.ts +11 -9
- package/src/gnode.ts +12 -5
- package/src/gport.ts +1 -1
- package/src/gpre-rendered-element.ts +1 -1
- package/src/gshape-element.ts +1 -1
- package/src/gshaped-prerendered-element.ts +61 -0
- package/src/index.ts +4 -2
- 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/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
|
-
type = DefaultTypes.COMPARTMENT;
|
|
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
|
-
addLayoutOption(key: string, value: JsonPrimitive): this {
|
|
39
|
-
return GLayoutableBuilder.addLayoutOption(this, key, value);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
addLayoutOptions(layoutOptions: Args): this;
|
|
43
|
-
addLayoutOptions(layoutOptions: Map<string, JsonPrimitive>): this;
|
|
44
|
-
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
|
@@ -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,7 +27,7 @@ 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
|
|
|
@@ -38,7 +38,7 @@ export function isGEdgeLayoutable<G extends GModelElement>(element: G): element
|
|
|
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
|
}
|
package/src/gedge.ts
CHANGED
package/src/ggraph.ts
CHANGED
|
@@ -19,19 +19,22 @@
|
|
|
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,
|
|
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
|
-
static builder(): GGraphBuilder {
|
|
27
|
+
export class GGraph extends GModelRoot implements GBoundsAware, GLayoutable {
|
|
28
|
+
static override builder(): GGraphBuilder {
|
|
28
29
|
return new GGraphBuilder(GGraph);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
type = types.GRAPH;
|
|
32
|
-
position: Point =
|
|
32
|
+
override type = types.GRAPH;
|
|
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
|
}
|
package/src/ghtmlroot.ts
ADDED
|
@@ -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,7 +24,11 @@ export class GIssue {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export class GIssueMarker extends GShapeElement {
|
|
27
|
-
|
|
27
|
+
static builder(): GIssueMarkerBuilder {
|
|
28
|
+
return new GIssueMarkerBuilder(GIssueMarker).type(DefaultTypes.ISSUE_MARKER);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override type = DefaultTypes.ISSUE_MARKER;
|
|
28
32
|
issues: GIssue[] = [];
|
|
29
33
|
}
|
|
30
34
|
|
package/src/glabel.ts
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { DefaultTypes,
|
|
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
|
|
|
@@ -24,10 +24,10 @@ export class GLabel extends GShapeElement implements GAlignable, GEdgeLayoutable
|
|
|
24
24
|
return new GLabelBuilder(constructor ?? GLabel).type(DefaultTypes.LABEL);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
type = DefaultTypes.LABEL;
|
|
27
|
+
override type = DefaultTypes.LABEL;
|
|
28
28
|
text: string;
|
|
29
|
-
alignment: Point =
|
|
30
|
-
edgePlacement?:
|
|
29
|
+
alignment: Point = Point.ORIGIN;
|
|
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
|
}
|
|
@@ -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 ((element as any)[
|
|
25
|
+
export function isGLayouting<G extends GModelElement>(element: G): element is G & GLayouting {
|
|
26
|
+
return ((element as any)[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
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
Bounds,
|
|
19
19
|
Dimension,
|
|
20
20
|
flatPush,
|
|
21
|
-
isSModelElementSchema,
|
|
22
21
|
JsonPrimitive,
|
|
23
22
|
MaybeArray,
|
|
24
23
|
Point,
|
|
@@ -26,14 +25,20 @@ import {
|
|
|
26
25
|
SModelRootSchema
|
|
27
26
|
} from '@eclipse-glsp/protocol';
|
|
28
27
|
import * as uuid from 'uuid';
|
|
28
|
+
|
|
29
29
|
export type GModelElementConstructor<G extends GModelElement = GModelElement> = new () => G;
|
|
30
30
|
/**
|
|
31
31
|
* Represents a `GModeElement` serialized as plain JSON object.
|
|
32
32
|
*/
|
|
33
33
|
export type GModelElementSchema = SModelElementSchema;
|
|
34
34
|
|
|
35
|
-
export
|
|
36
|
-
|
|
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;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
/**
|
|
@@ -58,7 +63,8 @@ export abstract class GModelElement implements GModelElementSchema {
|
|
|
58
63
|
* A set of css classes that should be applied to the DOM element that corresponds to this element.
|
|
59
64
|
*/
|
|
60
65
|
cssClasses: string[] = [];
|
|
61
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
|
|
62
68
|
* the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
|
|
63
69
|
* of the DOM element that reflects this element.
|
|
64
70
|
*/
|
|
@@ -183,17 +189,13 @@ export abstract class GModelElementBuilder<G extends GModelElement> {
|
|
|
183
189
|
|
|
184
190
|
export type GModelRootSchema = SModelRootSchema;
|
|
185
191
|
|
|
186
|
-
export function isGModelRootSchema(schema: any): schema is GModelRootSchema {
|
|
187
|
-
return isSModelElementSchema(schema);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
192
|
export class GModelRoot extends GModelElement implements SModelRootSchema {
|
|
191
193
|
static builder(): GModelRootBuilder {
|
|
192
194
|
return new GModelRootBuilder(GModelRoot);
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
canvasBounds?: Bounds;
|
|
196
|
-
revision
|
|
198
|
+
revision?: number;
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
export class GModelRootBuilder<G extends GModelRoot = GModelRoot> extends GModelElementBuilder<G> {
|
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
|
-
type = DefaultTypes.NODE;
|
|
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/gport.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
18
17
|
import { DefaultTypes } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { GModelElement, GModelElementBuilder } from './gmodel-element';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Pre-rendered elements contain HTML or SVG code to be transferred to the DOM. This can be useful to
|
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
|
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
|
|
17
|
+
import { Dimension, Point } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { GAlignable } from './galignable';
|
|
19
|
+
import { GBoundsAware, GBoundsAwareBuilder } from './gbounds-aware';
|
|
20
|
+
import { GModelElementBuilder } from './gmodel-element';
|
|
21
|
+
import { GPreRenderedElement } from './gpre-rendered-element';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Pre-rendered elements contain HTML or SVG code to be transferred to the DOM. This can be useful to
|
|
25
|
+
* render complex figures or to compute the view on the server instead of the client code.
|
|
26
|
+
* Pre rendered elements are often used for the popup model that is created by a `PopupModelFactory`.
|
|
27
|
+
* A popup model is rendered when hovering over a element and for many common use cases e.g rendering a tooltip
|
|
28
|
+
* this model can be computed entirely on the server side.
|
|
29
|
+
*/
|
|
30
|
+
export class GShapedPreRenderedElement extends GPreRenderedElement implements GBoundsAware, GAlignable {
|
|
31
|
+
static override builder(): GShapePreRenderedElementBuilder {
|
|
32
|
+
return new GShapePreRenderedElementBuilder(GShapedPreRenderedElement);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
position: Point;
|
|
36
|
+
size: Dimension;
|
|
37
|
+
alignment: Point;
|
|
38
|
+
[GBoundsAware] = true;
|
|
39
|
+
[GAlignable] = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class GShapePreRenderedElementBuilder<
|
|
43
|
+
G extends GShapedPreRenderedElement = GShapedPreRenderedElement
|
|
44
|
+
> extends GModelElementBuilder<G> {
|
|
45
|
+
code(code: string): this {
|
|
46
|
+
this.proxy.code = code;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
position(x: number, y: number): this;
|
|
51
|
+
position(position: Point): this;
|
|
52
|
+
position(pointOrX: Point | number, y?: number): this {
|
|
53
|
+
return GBoundsAwareBuilder.position(this, pointOrX, y);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
size(width: number, height: number): this;
|
|
57
|
+
size(size: Dimension): this;
|
|
58
|
+
size(sizeOrWidth: Dimension | number, height?: number): this {
|
|
59
|
+
return GBoundsAwareBuilder.size(this, sizeOrWidth, height);
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -15,19 +15,21 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
export * from './default-types';
|
|
17
17
|
export * from './galignable';
|
|
18
|
-
export * from './
|
|
18
|
+
export * from './gbounds-aware';
|
|
19
19
|
export * from './gbutton';
|
|
20
20
|
export * from './gcompartment';
|
|
21
21
|
export * from './gedge';
|
|
22
22
|
export * from './gedge-layoutable';
|
|
23
23
|
export * from './ggraph';
|
|
24
|
+
export * from './ghtmlroot';
|
|
24
25
|
export * from './gissue-marker';
|
|
25
26
|
export * from './glabel';
|
|
26
|
-
export * from './glayout-container';
|
|
27
27
|
export * from './glayoutable';
|
|
28
|
+
export * from './glayouting';
|
|
28
29
|
export * from './gmodel-element';
|
|
29
30
|
export * from './gmodel-util';
|
|
30
31
|
export * from './gnode';
|
|
31
32
|
export * from './gport';
|
|
32
33
|
export * from './gpre-rendered-element';
|
|
33
34
|
export * from './gshape-element';
|
|
35
|
+
export * from './gshaped-prerendered-element';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gbound-aware.d.ts","sourceRoot":"","sources":["../src/gbound-aware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,eAAO,MAAM,YAAY,eAAyB,CAAC;AAEnD,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,CAAC,Y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,MAAM,GAAG,CAAC,CAG3F;CACJ"}
|
package/lib/glayout-container.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|