@eclipse-glsp/sprotty 2.3.0-next.322 → 2.3.0-next.366
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/feature-modules.d.ts +3 -3
- package/lib/feature-modules.d.ts.map +1 -1
- package/lib/feature-modules.js +30 -29
- package/lib/feature-modules.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/re-exports.d.ts +19 -17
- package/lib/re-exports.d.ts.map +1 -1
- package/lib/re-exports.js +70 -53
- package/lib/re-exports.js.map +1 -1
- package/lib/svg-views-override.d.ts +47 -0
- package/lib/svg-views-override.d.ts.map +1 -0
- package/lib/svg-views-override.js +75 -0
- package/lib/svg-views-override.js.map +1 -0
- package/lib/types.d.ts +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +11 -6
- package/src/feature-modules.ts +18 -21
- package/src/index.ts +2 -2
- package/src/re-exports.ts +25 -38
- package/src/svg-views-override.tsx +92 -0
- package/src/types.ts +1 -1
- package/lib/routing-override.d.ts +0 -31
- package/lib/routing-override.d.ts.map +0 -1
- package/lib/routing-override.js +0 -72
- package/lib/routing-override.js.map +0 -1
- package/src/routing-override.ts +0 -88
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 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
|
+
/** @jsx svg */
|
|
17
|
+
import { Hoverable, Selectable } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { VNode } from 'snabbdom';
|
|
19
|
+
import { InternalBoundsAware as BoundsAware, IViewArgs, RenderingContext, SShapeElementImpl, CircularNodeView as SprottyCircularNodeView, DiamondNodeView as SprottyDiamondNodeView } from 'sprotty';
|
|
20
|
+
export declare class DiamondNodeView extends SprottyDiamondNodeView {
|
|
21
|
+
render(node: Readonly<SShapeElementImpl & Hoverable & Selectable>, context: RenderingContext, args?: IViewArgs): VNode | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare class CircularNodeView extends SprottyCircularNodeView {
|
|
24
|
+
render(node: Readonly<SShapeElementImpl & Hoverable & Selectable>, context: RenderingContext, args?: IViewArgs): VNode | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a hidden rectangle with the bounds of the given element.
|
|
28
|
+
* This is typically used to fixate the size of an element and avoid size changes that may happen during rendering.
|
|
29
|
+
* Changes can happen if the resulting bounding box (BBox) of the rendered element is different form the given bounds.
|
|
30
|
+
* The created bounding rect needs to be placed within a root SVG group (g) element to take effect.
|
|
31
|
+
*
|
|
32
|
+
* @param withBounds The element to create the hidden rectangle for.
|
|
33
|
+
* @param context The rendering context. If provided, a rect is only created if the context is 'hidden'.
|
|
34
|
+
* @returns The hidden rectangle.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hiddenBoundingRect(withBounds: BoundsAware): VNode;
|
|
37
|
+
export declare function hiddenBoundingRect(withBounds: BoundsAware, context: RenderingContext): VNode | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Applies a hidden bounding rectangle to the given view if we are in the hidden rendering context where sizes are being determined.
|
|
40
|
+
*
|
|
41
|
+
* @param withBounds The element to apply the hidden bounding rectangle to.
|
|
42
|
+
* @param context The rendering context.
|
|
43
|
+
* @param view The view to apply the hidden bounding rectangle to.
|
|
44
|
+
* @returns The view with the hidden bounding rectangle applied, wrapped in a group element if necessary.
|
|
45
|
+
*/
|
|
46
|
+
export declare function applyHiddenBoundingRect<V extends VNode | undefined>(withBounds: BoundsAware, context: RenderingContext, view: V): V;
|
|
47
|
+
//# sourceMappingURL=svg-views-override.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-views-override.d.ts","sourceRoot":"","sources":["../src/svg-views-override.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,eAAe;AACf,OAAO,EAAU,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAEH,mBAAmB,IAAI,WAAW,EAClC,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,IAAI,uBAAuB,EAC3C,eAAe,IAAI,sBAAsB,EAE5C,MAAM,SAAS,CAAC;AAEjB,qBACa,eAAgB,SAAQ,sBAAsB;IAC9C,MAAM,CACX,IAAI,EAAE,QAAQ,CAAC,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC,EAC1D,OAAO,EAAE,gBAAgB,EACzB,IAAI,CAAC,EAAE,SAAS,GACjB,KAAK,GAAG,SAAS;CAKvB;AAED,qBACa,gBAAiB,SAAQ,uBAAuB;IAChD,MAAM,CACX,IAAI,EAAE,QAAQ,CAAC,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC,EAC1D,OAAO,EAAE,gBAAgB,EACzB,IAAI,CAAC,EAAE,SAAS,GACjB,KAAK,GAAG,SAAS;CAKvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,WAAW,GAAG,KAAK,CAAC;AACnE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,GAAG,SAAS,CAAC;AAS1G;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,KAAK,GAAG,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAOnI"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.applyHiddenBoundingRect = exports.hiddenBoundingRect = exports.CircularNodeView = exports.DiamondNodeView = void 0;
|
|
10
|
+
/********************************************************************************
|
|
11
|
+
* Copyright (c) 2024 EclipseSource and others.
|
|
12
|
+
*
|
|
13
|
+
* This program and the accompanying materials are made available under the
|
|
14
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
15
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
16
|
+
*
|
|
17
|
+
* This Source Code may also be made available under the following Secondary
|
|
18
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
19
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
20
|
+
* with the GNU Classpath Exception which is available at
|
|
21
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
22
|
+
*
|
|
23
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
24
|
+
********************************************************************************/
|
|
25
|
+
/** @jsx svg */
|
|
26
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
27
|
+
const inversify_1 = require("inversify");
|
|
28
|
+
const sprotty_1 = require("sprotty");
|
|
29
|
+
let DiamondNodeView = class DiamondNodeView extends sprotty_1.DiamondNodeView {
|
|
30
|
+
render(node, context, args) {
|
|
31
|
+
// The super class may change the bounds of the given node as browsers may calculate larger bounds for the rendered node (BBox).
|
|
32
|
+
// To ensure that the node's bounds remains unchanged, we render a rectangle with the correct bounds during hidden rendering.
|
|
33
|
+
return applyHiddenBoundingRect(node, context, super.render(node, context, args));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.DiamondNodeView = DiamondNodeView;
|
|
37
|
+
exports.DiamondNodeView = DiamondNodeView = __decorate([
|
|
38
|
+
(0, inversify_1.injectable)()
|
|
39
|
+
], DiamondNodeView);
|
|
40
|
+
let CircularNodeView = class CircularNodeView extends sprotty_1.CircularNodeView {
|
|
41
|
+
render(node, context, args) {
|
|
42
|
+
// The super class may change the bounds of the given node as browsers may calculate larger bounds for the rendered node (BBox).
|
|
43
|
+
// To ensure that the node's bounds remains unchanged, we render a rectangle with the correct bounds during hidden rendering.
|
|
44
|
+
return applyHiddenBoundingRect(node, context, super.render(node, context, args));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.CircularNodeView = CircularNodeView;
|
|
48
|
+
exports.CircularNodeView = CircularNodeView = __decorate([
|
|
49
|
+
(0, inversify_1.injectable)()
|
|
50
|
+
], CircularNodeView);
|
|
51
|
+
function hiddenBoundingRect(withBounds, context) {
|
|
52
|
+
// an element with attribute ATTR_BBOX_ELEMENT is used by the hidden bounds updater to determine the bounds if it is within a g-element
|
|
53
|
+
// we set the fill to transparent since the SVG export uses the hidden rendering to generate the image and we do not want to be seen
|
|
54
|
+
return !context || context.targetKind === 'hidden' ? ((0, sprotty_1.svg)("rect", Object.assign({ attrs: { [sprotty_1.ATTR_BBOX_ELEMENT]: true } }, protocol_1.Bounds.dimension(withBounds.bounds), { style: { fill: 'transparent' } }))) : undefined;
|
|
55
|
+
}
|
|
56
|
+
exports.hiddenBoundingRect = hiddenBoundingRect;
|
|
57
|
+
/**
|
|
58
|
+
* Applies a hidden bounding rectangle to the given view if we are in the hidden rendering context where sizes are being determined.
|
|
59
|
+
*
|
|
60
|
+
* @param withBounds The element to apply the hidden bounding rectangle to.
|
|
61
|
+
* @param context The rendering context.
|
|
62
|
+
* @param view The view to apply the hidden bounding rectangle to.
|
|
63
|
+
* @returns The view with the hidden bounding rectangle applied, wrapped in a group element if necessary.
|
|
64
|
+
*/
|
|
65
|
+
function applyHiddenBoundingRect(withBounds, context, view) {
|
|
66
|
+
var _a;
|
|
67
|
+
if (view && context.targetKind === 'hidden') {
|
|
68
|
+
const parent = view.sel === 'g' ? view : (0, sprotty_1.svg)("g", null, view);
|
|
69
|
+
(_a = parent.children) === null || _a === void 0 ? void 0 : _a.unshift(hiddenBoundingRect(withBounds));
|
|
70
|
+
return parent;
|
|
71
|
+
}
|
|
72
|
+
return view;
|
|
73
|
+
}
|
|
74
|
+
exports.applyHiddenBoundingRect = applyHiddenBoundingRect;
|
|
75
|
+
//# sourceMappingURL=svg-views-override.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-views-override.js","sourceRoot":"","sources":["../src/svg-views-override.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,eAAe;AACf,qDAAuE;AACvE,yCAAuC;AAEvC,qCASiB;AAGV,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,yBAAsB;IAC9C,MAAM,CACX,IAA0D,EAC1D,OAAyB,EACzB,IAAgB;QAEhB,gIAAgI;QAChI,6HAA6H;QAC7H,OAAO,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IACrF,CAAC;CACJ,CAAA;AAVY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CAU3B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,0BAAuB;IAChD,MAAM,CACX,IAA0D,EAC1D,OAAyB,EACzB,IAAgB;QAEhB,gIAAgI;QAChI,6HAA6H;QAC7H,OAAO,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IACrF,CAAC;CACJ,CAAA;AAVY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAU5B;AAcD,SAAgB,kBAAkB,CAAC,UAAuB,EAAE,OAA0B;IAClF,uIAAuI;IACvI,oIAAoI;IACpI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CACjD,2CAAM,KAAK,EAAE,EAAE,CAAC,2BAAiB,CAAC,EAAE,IAAI,EAAE,IAAM,iBAAM,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAE,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,CAC1H,CAAC,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC;AAND,gDAMC;AAED;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAA8B,UAAuB,EAAE,OAAyB,EAAE,IAAO;;IAC5H,IAAI,IAAI,IAAI,OAAO,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,8BAAI,IAAI,CAAK,CAAC;QACvD,MAAA,MAAM,CAAC,QAAQ,0CAAE,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAPD,0DAOC"}
|
package/lib/types.d.ts
CHANGED
package/lib/types.js
CHANGED
|
@@ -25,5 +25,5 @@ const IGModelRootListener = Symbol('IGModelRootListener');
|
|
|
25
25
|
exports.TYPES = Object.assign(Object.assign({}, sprotty_1.TYPES), { IAsyncClipboardService: Symbol('IAsyncClipboardService'), IEditorContextServiceProvider: Symbol('IEditorContextProvider'), IFeedbackActionDispatcher: Symbol('IFeedbackActionDispatcher'), IToolFactory: Symbol('Factory<Tool>'), ITypeHintProvider: Symbol('ITypeHintProvider'), IMovementRestrictor: Symbol('IMovementRestrictor'), ISelectionListener: Symbol('ISelectionListener'),
|
|
26
26
|
/** @deprecated Use {@link TYPES.IGModelRootListener} instead */
|
|
27
27
|
// eslint-disable-next-line deprecation/deprecation
|
|
28
|
-
ISModelRootListener: IGModelRootListener, IGModelRootListener: IGModelRootListener, IContextMenuProvider: Symbol('IContextMenuProvider'), ICopyPasteHandler: Symbol('ICopyPasteHandler'), ITool: Symbol('ITool'), IDefaultTool: Symbol('IDefaultTool'), IEditModeListener: Symbol('IEditModeListener'), IMarqueeBehavior: Symbol('IMarqueeBehavior'), IHelperLineManager: Symbol('IHelperLineManager'), IHelperLineOptions: Symbol('IHelperLineOptions'), IElementNavigator: Symbol('IElementNavigator'), ILocalElementNavigator: Symbol('ILocalElementNavigator'), IDiagramOptions: Symbol('IDiagramOptions'), IDiagramStartup: Symbol('IDiagramStartup'), IToolManager: Symbol('IToolManager'),
|
|
28
|
+
ISModelRootListener: IGModelRootListener, IGModelRootListener: IGModelRootListener, IContextMenuProvider: Symbol('IContextMenuProvider'), ICopyPasteHandler: Symbol('ICopyPasteHandler'), ITool: Symbol('ITool'), IDefaultTool: Symbol('IDefaultTool'), IEditModeListener: Symbol('IEditModeListener'), IMarqueeBehavior: Symbol('IMarqueeBehavior'), IHelperLineManager: Symbol('IHelperLineManager'), IHelperLineOptions: Symbol('IHelperLineOptions'), IElementNavigator: Symbol('IElementNavigator'), ILocalElementNavigator: Symbol('ILocalElementNavigator'), IDiagramOptions: Symbol('IDiagramOptions'), IDiagramStartup: Symbol('IDiagramStartup'), IToolManager: Symbol('IToolManager'), Grid: Symbol('Grid') });
|
|
29
29
|
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qCAAgD;AAEhD;;;GAGG;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE7C,QAAA,KAAK,mCACX,eAAY,KACf,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC,EACxD,6BAA6B,EAAE,MAAM,CAAC,wBAAwB,CAAC,EAC/D,yBAAyB,EAAE,MAAM,CAAC,2BAA2B,CAAC,EAC9D,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC,EAClD,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,gEAAgE;IAChE,mDAAmD;IACnD,mBAAmB,EAAE,mBAAmB,EACxC,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC,EACpD,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,EACpC,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,CAAC,EAC5C,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAChD,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAChD,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC,EACxD,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAC1C,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAC1C,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,EACpC,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qCAAgD;AAEhD;;;GAGG;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE7C,QAAA,KAAK,mCACX,eAAY,KACf,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC,EACxD,6BAA6B,EAAE,MAAM,CAAC,wBAAwB,CAAC,EAC/D,yBAAyB,EAAE,MAAM,CAAC,2BAA2B,CAAC,EAC9D,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC,EAClD,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,gEAAgE;IAChE,mDAAmD;IACnD,mBAAmB,EAAE,mBAAmB,EACxC,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC,EACpD,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,EACpC,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,CAAC,EAC5C,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAChD,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAChD,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAC9C,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC,EACxD,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAC1C,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAC1C,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,EACpC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/sprotty",
|
|
3
|
-
"version": "2.3.0-next.
|
|
3
|
+
"version": "2.3.0-next.366+b0e3022",
|
|
4
4
|
"description": "Augmented reexport of the sprotty API for GLSP",
|
|
5
5
|
"homepage": "https://www.eclipse.org/glsp/",
|
|
6
6
|
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
|
|
@@ -28,23 +28,28 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsc -b",
|
|
30
30
|
"clean": "rimraf lib *.tsbuildinfo",
|
|
31
|
+
"generate:index": "glsp generateIndex src -f -s",
|
|
31
32
|
"lint": "eslint --ext .ts,.tsx ./src",
|
|
32
33
|
"watch": "tsc -w"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@eclipse-glsp/protocol": "2.3.0-next.
|
|
36
|
+
"@eclipse-glsp/protocol": "2.3.0-next.366+b0e3022",
|
|
36
37
|
"autocompleter": "^9.1.0",
|
|
37
|
-
"snabbdom": "
|
|
38
|
-
"sprotty": "1.
|
|
39
|
-
"sprotty-protocol": "1.
|
|
38
|
+
"snabbdom": "~3.5.1",
|
|
39
|
+
"sprotty": "1.2.0",
|
|
40
|
+
"sprotty-protocol": "1.2.0",
|
|
41
|
+
"vscode-jsonrpc": "8.2.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@types/jsdom": "^21.1.3",
|
|
43
45
|
"@vscode/codicons": "^0.0.25",
|
|
44
46
|
"snabbdom-to-html": "^7.1.0"
|
|
45
47
|
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"inversify": "~6.0.2"
|
|
50
|
+
},
|
|
46
51
|
"publishConfig": {
|
|
47
52
|
"access": "public"
|
|
48
53
|
},
|
|
49
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "b0e3022fbd2df727a7604e530a27fa92ace29900"
|
|
50
55
|
}
|
package/src/feature-modules.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 EclipseSource 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,35 +14,32 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
/* eslint-disable no-restricted-imports */
|
|
17
|
-
|
|
18
|
-
import
|
|
17
|
+
import { FeatureModule } from '@eclipse-glsp/protocol/lib/di';
|
|
18
|
+
import sprottyDefaultModule from 'sprotty/lib/base/di.config';
|
|
19
19
|
import sprottyButtonModule from 'sprotty/lib/features/button/di.config';
|
|
20
20
|
import sprottyEdgeIntersectionModule from 'sprotty/lib/features/edge-intersection/di.config';
|
|
21
|
+
import sprottyEdgeJunctionModule from 'sprotty/lib/features/edge-junction/di.config';
|
|
21
22
|
import sprottyEdgeLayoutModule from 'sprotty/lib/features/edge-layout/di.config';
|
|
22
|
-
import {
|
|
23
|
-
edgeEditModule as sprottyEdgeEditModule,
|
|
24
|
-
labelEditUiModule as sprottyLabelEditUiModule
|
|
25
|
-
} from 'sprotty/lib/features/edit/di.config';
|
|
23
|
+
import { edgeEditModule as sprottyEdgeEditModule } from 'sprotty/lib/features/edit/di.config';
|
|
26
24
|
import sprottyExpandModule from 'sprotty/lib/features/expand/di.config';
|
|
27
25
|
import sprottyFadeModule from 'sprotty/lib/features/fade/di.config';
|
|
28
26
|
import sprottyMoveModule from 'sprotty/lib/features/move/di.config';
|
|
27
|
+
import sprottyOpenModule from 'sprotty/lib/features/open/di.config';
|
|
29
28
|
import sprottyUpdateModule from 'sprotty/lib/features/update/di.config';
|
|
30
29
|
import sprottyZorderModule from 'sprotty/lib/features/zorder/di.config';
|
|
31
30
|
import sprottyModelSourceModule from 'sprotty/lib/model-source/di.config';
|
|
32
|
-
import sprottyDefaultModule from 'sprotty/lib/base/di.config';
|
|
33
|
-
import sprottyOpenModule from 'sprotty/lib/features/open/di.config';
|
|
34
31
|
|
|
35
|
-
export const buttonModule = new FeatureModule(sprottyButtonModule.registry);
|
|
36
|
-
export const edgeEditModule = new FeatureModule(sprottyEdgeEditModule.registry);
|
|
37
|
-
export const edgeIntersectionModule = new FeatureModule(sprottyEdgeIntersectionModule.registry);
|
|
38
|
-
export const edgeLayoutModule = new FeatureModule(sprottyEdgeLayoutModule.registry);
|
|
39
|
-
export const expandModule = new FeatureModule(sprottyExpandModule.registry);
|
|
40
|
-
export const fadeModule = new FeatureModule(sprottyFadeModule.registry);
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
32
|
+
export const buttonModule = new FeatureModule(sprottyButtonModule.registry, { featureId: Symbol('button') });
|
|
33
|
+
export const edgeEditModule = new FeatureModule(sprottyEdgeEditModule.registry, { featureId: Symbol('edgeEdit') });
|
|
34
|
+
export const edgeIntersectionModule = new FeatureModule(sprottyEdgeIntersectionModule.registry, { featureId: Symbol('edgeIntersection') });
|
|
35
|
+
export const edgeLayoutModule = new FeatureModule(sprottyEdgeLayoutModule.registry, { featureId: Symbol('edgeLayout') });
|
|
36
|
+
export const expandModule = new FeatureModule(sprottyExpandModule.registry, { featureId: Symbol('expand') });
|
|
37
|
+
export const fadeModule = new FeatureModule(sprottyFadeModule.registry, { featureId: Symbol('fade') });
|
|
38
|
+
export const modelSourceModule = new FeatureModule(sprottyModelSourceModule.registry, { featureId: Symbol('modelSource') });
|
|
39
|
+
export const moveModule = new FeatureModule(sprottyMoveModule.registry, { featureId: Symbol('move') });
|
|
40
|
+
export const openModule = new FeatureModule(sprottyOpenModule.registry, { featureId: Symbol('open') });
|
|
41
|
+
export const updateModule = new FeatureModule(sprottyUpdateModule.registry, { featureId: Symbol('update') });
|
|
42
|
+
export const zorderModule = new FeatureModule(sprottyZorderModule.registry, { featureId: Symbol('zorder') });
|
|
43
|
+
export const edgeJunctionModule = new FeatureModule(sprottyEdgeJunctionModule.registry, { featureId: Symbol('edgeJunction') });
|
|
47
44
|
|
|
48
45
|
export { sprottyDefaultModule };
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024 EclipseSource 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
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
export * from './action-override';
|
|
17
17
|
export * from './feature-modules';
|
|
18
18
|
export * from './re-exports';
|
|
19
|
-
export * from './
|
|
19
|
+
export * from './svg-views-override';
|
|
20
20
|
export * from './types';
|
package/src/re-exports.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* @eclipse-glsp/protocol
|
|
19
19
|
*/
|
|
20
20
|
export * from '@eclipse-glsp/protocol';
|
|
21
|
+
export * from '@eclipse-glsp/protocol/lib/di';
|
|
21
22
|
|
|
22
23
|
/*
|
|
23
24
|
* sprotty
|
|
@@ -96,14 +97,14 @@ export * from 'sprotty/lib/features/bounds/bounds-manipulation';
|
|
|
96
97
|
export * from 'sprotty/lib/features/bounds/hbox-layout';
|
|
97
98
|
export * from 'sprotty/lib/features/bounds/hidden-bounds-updater';
|
|
98
99
|
export * from 'sprotty/lib/features/bounds/layout';
|
|
99
|
-
export
|
|
100
|
+
export { AbstractLayoutOptions } from 'sprotty/lib/features/bounds/layout-options';
|
|
100
101
|
export {
|
|
101
|
-
|
|
102
|
-
BoundsAware,
|
|
102
|
+
InternalBoundsAware as BoundsAware,
|
|
103
103
|
SShapeElementImpl as GShapeElement,
|
|
104
|
-
LayoutContainer,
|
|
105
|
-
LayoutableChild,
|
|
104
|
+
InternalLayoutContainer as LayoutContainer,
|
|
105
|
+
InternalLayoutableChild as LayoutableChild,
|
|
106
106
|
ModelLayoutOptions,
|
|
107
|
+
alignFeature,
|
|
107
108
|
boundsFeature,
|
|
108
109
|
findChildrenAtPosition,
|
|
109
110
|
getAbsoluteBounds,
|
|
@@ -122,7 +123,7 @@ export * from 'sprotty/lib/features/bounds/vbox-layout';
|
|
|
122
123
|
export * from 'sprotty/lib/features/bounds/views';
|
|
123
124
|
|
|
124
125
|
export { ButtonHandlerRegistry, IButtonHandlerRegistration, configureButtonHandler } from 'sprotty/lib/features/button/button-handler';
|
|
125
|
-
export { SButtonImpl as GButton
|
|
126
|
+
export { SButtonImpl as GButton } from 'sprotty/lib/features/button/model';
|
|
126
127
|
|
|
127
128
|
export {
|
|
128
129
|
CommandPaletteActionProviderRegistry,
|
|
@@ -130,14 +131,14 @@ export {
|
|
|
130
131
|
} from 'sprotty/lib/features/command-palette/action-providers';
|
|
131
132
|
export * from 'sprotty/lib/features/command-palette/command-palette';
|
|
132
133
|
|
|
133
|
-
// Exclude menu item.
|
|
134
|
+
// Exclude menu item. Already provided by glsp-protocol
|
|
134
135
|
export { Anchor, IContextMenuService, IContextMenuServiceProvider } from 'sprotty/lib/features/context-menu/context-menu-service';
|
|
135
136
|
export { ContextMenuProviderRegistry, DeleteContextMenuItemProvider } from 'sprotty/lib/features/context-menu/menu-providers';
|
|
136
137
|
export * from 'sprotty/lib/features/context-menu/mouse-listener';
|
|
137
138
|
|
|
138
139
|
export * from 'sprotty/lib/features/edge-layout/di.config';
|
|
139
140
|
export * from 'sprotty/lib/features/edge-layout/edge-layout';
|
|
140
|
-
export
|
|
141
|
+
export { DEFAULT_EDGE_PLACEMENT, checkEdgePlacement, edgeLayoutFeature, isEdgeLayoutable } from 'sprotty/lib/features/edge-layout/model';
|
|
141
142
|
// Exclude client-side creation features (not supported in GLSP)
|
|
142
143
|
// export * from 'sprotty/lib/features/edit/create';
|
|
143
144
|
// export * from 'sprotty/lib/features/edit/create-on-drag';
|
|
@@ -149,7 +150,7 @@ export * from 'sprotty/lib/features/edit/model';
|
|
|
149
150
|
// export * from 'sprotty/lib/features/edit/reconnect';
|
|
150
151
|
|
|
151
152
|
export * from 'sprotty/lib/features/expand/expand';
|
|
152
|
-
export
|
|
153
|
+
export { expandFeature, isExpandable } from 'sprotty/lib/features/expand/model';
|
|
153
154
|
export * from 'sprotty/lib/features/expand/views';
|
|
154
155
|
// Exclude RequestExportSvgAction. Already provided by glsp-protocol
|
|
155
156
|
export { ExportSvgCommand, ExportSvgKeyListener, ExportSvgPostprocessor } from 'sprotty/lib/features/export/export';
|
|
@@ -158,10 +159,10 @@ export * from 'sprotty/lib/features/export/model';
|
|
|
158
159
|
export { SvgExporter } from 'sprotty/lib/features/export/svg-exporter';
|
|
159
160
|
|
|
160
161
|
export * from 'sprotty/lib/features/fade/fade';
|
|
161
|
-
export
|
|
162
|
+
export { fadeFeature, isFadeable } from 'sprotty/lib/features/fade/model';
|
|
162
163
|
|
|
163
164
|
export * from 'sprotty/lib/features/hover/hover';
|
|
164
|
-
export
|
|
165
|
+
export { hasPopupFeature, hoverFeedbackFeature, isHoverable, popupFeature } from 'sprotty/lib/features/hover/model';
|
|
165
166
|
export * from 'sprotty/lib/features/hover/popup-position-updater';
|
|
166
167
|
|
|
167
168
|
// Alias SModel types
|
|
@@ -169,10 +170,7 @@ export * from 'sprotty/lib/features/decoration/decoration-placer';
|
|
|
169
170
|
export {
|
|
170
171
|
Decoration,
|
|
171
172
|
SDecoration as GDecoration,
|
|
172
|
-
|
|
173
|
-
SIssueSeverity as GIssueSeverity,
|
|
174
|
-
// Export as is, we extend it glsp-client to `GIssueMarker`
|
|
175
|
-
SIssueMarker,
|
|
173
|
+
SIssueMarkerImpl,
|
|
176
174
|
decorationFeature,
|
|
177
175
|
isDecoration
|
|
178
176
|
} from 'sprotty/lib/features/decoration/model';
|
|
@@ -181,7 +179,9 @@ export * from 'sprotty/lib/features/decoration/views';
|
|
|
181
179
|
export * from 'sprotty/lib/features/edge-intersection/intersection-finder';
|
|
182
180
|
export * from 'sprotty/lib/features/edge-intersection/sweepline';
|
|
183
181
|
|
|
184
|
-
export * from 'sprotty/lib/features/
|
|
182
|
+
export * from 'sprotty/lib/features/edge-junction/junction-finder';
|
|
183
|
+
|
|
184
|
+
export { isLocateable, isMoveable, moveFeature } from 'sprotty/lib/features/move/model';
|
|
185
185
|
export * from 'sprotty/lib/features/move/move';
|
|
186
186
|
export * from 'sprotty/lib/features/move/snap';
|
|
187
187
|
|
|
@@ -190,28 +190,15 @@ export * from 'sprotty/lib/features/nameable/model';
|
|
|
190
190
|
export * from 'sprotty/lib/features/open/model';
|
|
191
191
|
export * from 'sprotty/lib/features/open/open';
|
|
192
192
|
|
|
193
|
-
export
|
|
193
|
+
export { ViewProjection, getModelBounds, getProjectedBounds, getProjections, isProjectable } from 'sprotty/lib/features/projection/model';
|
|
194
194
|
export * from 'sprotty/lib/features/projection/views';
|
|
195
195
|
|
|
196
|
-
export
|
|
197
|
-
DefaultAnchors,
|
|
198
|
-
LinearRouteOptions,
|
|
199
|
-
Side,
|
|
200
|
-
AbstractEdgeRouter as SprottyAbstractEdgeRouter
|
|
201
|
-
} from 'sprotty/lib/features/routing/abstract-edge-router';
|
|
196
|
+
export * from 'sprotty/lib/features/routing/abstract-edge-router';
|
|
202
197
|
export * from 'sprotty/lib/features/routing/anchor';
|
|
203
198
|
export * from 'sprotty/lib/features/routing/bezier-anchors';
|
|
204
|
-
export
|
|
205
|
-
AddRemoveBezierSegmentAction,
|
|
206
|
-
AddRemoveBezierSegmentCommand,
|
|
207
|
-
BezierMouseListener,
|
|
208
|
-
BezierEdgeRouter as SprottyBezierEdgeRouter
|
|
209
|
-
} from 'sprotty/lib/features/routing/bezier-edge-router';
|
|
199
|
+
export * from 'sprotty/lib/features/routing/bezier-edge-router';
|
|
210
200
|
export * from 'sprotty/lib/features/routing/manhattan-anchors';
|
|
211
|
-
export
|
|
212
|
-
ManhattanRouterOptions,
|
|
213
|
-
ManhattanEdgeRouter as SprottyManhattanEdgeRouter
|
|
214
|
-
} from 'sprotty/lib/features/routing/manhattan-edge-router';
|
|
201
|
+
export * from 'sprotty/lib/features/routing/manhattan-edge-router';
|
|
215
202
|
|
|
216
203
|
// Alias SModel types
|
|
217
204
|
export {
|
|
@@ -229,11 +216,11 @@ export {
|
|
|
229
216
|
isConnectable
|
|
230
217
|
} from 'sprotty/lib/features/routing/model';
|
|
231
218
|
export * from 'sprotty/lib/features/routing/polyline-anchors';
|
|
232
|
-
export
|
|
219
|
+
export * from 'sprotty/lib/features/routing/polyline-edge-router';
|
|
233
220
|
export * from 'sprotty/lib/features/routing/routing';
|
|
234
221
|
export * from 'sprotty/lib/features/routing/views';
|
|
235
222
|
|
|
236
|
-
export
|
|
223
|
+
export { isSelectable, isSelected, selectFeature } from 'sprotty/lib/features/select/model';
|
|
237
224
|
// Alias Select commands with sprotty prefix to avoid clash with glsp-client
|
|
238
225
|
export {
|
|
239
226
|
GetSelectionCommand,
|
|
@@ -278,12 +265,12 @@ export {
|
|
|
278
265
|
SBezierControlHandleView as GBezierControlHandleView,
|
|
279
266
|
SBezierCreateHandleView as GBezierCreateHandleView,
|
|
280
267
|
SCompartmentView as GCompartmentView,
|
|
281
|
-
SGraphView as GGraphView,
|
|
282
268
|
SLabelView as GLabelView,
|
|
283
269
|
SRoutingHandleView as GRoutingHandleView,
|
|
284
270
|
JumpingPolylineEdgeView,
|
|
285
271
|
PolylineEdgeView,
|
|
286
|
-
PolylineEdgeViewWithGapsOnIntersections
|
|
272
|
+
PolylineEdgeViewWithGapsOnIntersections,
|
|
273
|
+
SGraphView
|
|
287
274
|
} from 'sprotty/lib/graph/views';
|
|
288
275
|
|
|
289
276
|
// ------------------ Library ------------------
|
|
@@ -304,7 +291,7 @@ export {
|
|
|
304
291
|
RectangularPort
|
|
305
292
|
} from 'sprotty/lib/lib/model';
|
|
306
293
|
export * from 'sprotty/lib/lib/modules';
|
|
307
|
-
export
|
|
294
|
+
export { EmptyGroupView, RectangularNodeView, SvgViewportView } from 'sprotty/lib/lib/svg-views';
|
|
308
295
|
|
|
309
296
|
// ------------------ Model Source ------------------
|
|
310
297
|
export * from 'sprotty/lib/model-source/commit-model';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 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
|
+
/** @jsx svg */
|
|
17
|
+
import { Bounds, Hoverable, Selectable } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { injectable } from 'inversify';
|
|
19
|
+
import { VNode } from 'snabbdom';
|
|
20
|
+
import {
|
|
21
|
+
ATTR_BBOX_ELEMENT,
|
|
22
|
+
InternalBoundsAware as BoundsAware,
|
|
23
|
+
IViewArgs,
|
|
24
|
+
RenderingContext,
|
|
25
|
+
SShapeElementImpl,
|
|
26
|
+
CircularNodeView as SprottyCircularNodeView,
|
|
27
|
+
DiamondNodeView as SprottyDiamondNodeView,
|
|
28
|
+
svg
|
|
29
|
+
} from 'sprotty';
|
|
30
|
+
|
|
31
|
+
@injectable()
|
|
32
|
+
export class DiamondNodeView extends SprottyDiamondNodeView {
|
|
33
|
+
override render(
|
|
34
|
+
node: Readonly<SShapeElementImpl & Hoverable & Selectable>,
|
|
35
|
+
context: RenderingContext,
|
|
36
|
+
args?: IViewArgs
|
|
37
|
+
): VNode | undefined {
|
|
38
|
+
// The super class may change the bounds of the given node as browsers may calculate larger bounds for the rendered node (BBox).
|
|
39
|
+
// To ensure that the node's bounds remains unchanged, we render a rectangle with the correct bounds during hidden rendering.
|
|
40
|
+
return applyHiddenBoundingRect(node, context, super.render(node, context, args));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@injectable()
|
|
45
|
+
export class CircularNodeView extends SprottyCircularNodeView {
|
|
46
|
+
override render(
|
|
47
|
+
node: Readonly<SShapeElementImpl & Hoverable & Selectable>,
|
|
48
|
+
context: RenderingContext,
|
|
49
|
+
args?: IViewArgs
|
|
50
|
+
): VNode | undefined {
|
|
51
|
+
// The super class may change the bounds of the given node as browsers may calculate larger bounds for the rendered node (BBox).
|
|
52
|
+
// To ensure that the node's bounds remains unchanged, we render a rectangle with the correct bounds during hidden rendering.
|
|
53
|
+
return applyHiddenBoundingRect(node, context, super.render(node, context, args));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Creates a hidden rectangle with the bounds of the given element.
|
|
59
|
+
* This is typically used to fixate the size of an element and avoid size changes that may happen during rendering.
|
|
60
|
+
* Changes can happen if the resulting bounding box (BBox) of the rendered element is different form the given bounds.
|
|
61
|
+
* The created bounding rect needs to be placed within a root SVG group (g) element to take effect.
|
|
62
|
+
*
|
|
63
|
+
* @param withBounds The element to create the hidden rectangle for.
|
|
64
|
+
* @param context The rendering context. If provided, a rect is only created if the context is 'hidden'.
|
|
65
|
+
* @returns The hidden rectangle.
|
|
66
|
+
*/
|
|
67
|
+
export function hiddenBoundingRect(withBounds: BoundsAware): VNode;
|
|
68
|
+
export function hiddenBoundingRect(withBounds: BoundsAware, context: RenderingContext): VNode | undefined;
|
|
69
|
+
export function hiddenBoundingRect(withBounds: BoundsAware, context?: RenderingContext): VNode | undefined {
|
|
70
|
+
// an element with attribute ATTR_BBOX_ELEMENT is used by the hidden bounds updater to determine the bounds if it is within a g-element
|
|
71
|
+
// we set the fill to transparent since the SVG export uses the hidden rendering to generate the image and we do not want to be seen
|
|
72
|
+
return !context || context.targetKind === 'hidden' ? (
|
|
73
|
+
<rect attrs={{ [ATTR_BBOX_ELEMENT]: true }} {...Bounds.dimension(withBounds.bounds)} style={{ fill: 'transparent' }} />
|
|
74
|
+
) : undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Applies a hidden bounding rectangle to the given view if we are in the hidden rendering context where sizes are being determined.
|
|
79
|
+
*
|
|
80
|
+
* @param withBounds The element to apply the hidden bounding rectangle to.
|
|
81
|
+
* @param context The rendering context.
|
|
82
|
+
* @param view The view to apply the hidden bounding rectangle to.
|
|
83
|
+
* @returns The view with the hidden bounding rectangle applied, wrapped in a group element if necessary.
|
|
84
|
+
*/
|
|
85
|
+
export function applyHiddenBoundingRect<V extends VNode | undefined>(withBounds: BoundsAware, context: RenderingContext, view: V): V {
|
|
86
|
+
if (view && context.targetKind === 'hidden') {
|
|
87
|
+
const parent = view.sel === 'g' ? view : <g>{view}</g>;
|
|
88
|
+
parent.children?.unshift(hiddenBoundingRect(withBounds));
|
|
89
|
+
return parent;
|
|
90
|
+
}
|
|
91
|
+
return view;
|
|
92
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2024 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
|
-
import { Point } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { SConnectableElementImpl, SParentElementImpl, SRoutableElementImpl, AbstractEdgeRouter as SprottyAbstractEdgeRouter, BezierEdgeRouter as SprottyBezierEdgeRouter, ManhattanEdgeRouter as SprottyManhattanEdgeRouter, PolylineEdgeRouter as SprottyPolylineEdgeRouter } from 'sprotty';
|
|
18
|
-
import { GConnectableElement, GParentElement, GRoutableElement } from './re-exports';
|
|
19
|
-
export declare abstract class AbstractEdgeRouter extends SprottyAbstractEdgeRouter {
|
|
20
|
-
getTranslatedAnchor(connectable: SConnectableElementImpl, refPoint: Point, refContainer: SParentElementImpl, edge: SRoutableElementImpl, anchorCorrection?: number | undefined): Point;
|
|
21
|
-
}
|
|
22
|
-
export declare class PolylineEdgeRouter extends SprottyPolylineEdgeRouter {
|
|
23
|
-
getTranslatedAnchor(connectable: GConnectableElement, refPoint: Point, refContainer: GParentElement, edge: GRoutableElement, anchorCorrection?: number | undefined): Point;
|
|
24
|
-
}
|
|
25
|
-
export declare class ManhattanEdgeRouter extends SprottyManhattanEdgeRouter {
|
|
26
|
-
getTranslatedAnchor(connectable: GConnectableElement, refPoint: Point, refContainer: GParentElement, edge: GRoutableElement, anchorCorrection?: number | undefined): Point;
|
|
27
|
-
}
|
|
28
|
-
export declare class BezierEdgeRouter extends SprottyBezierEdgeRouter {
|
|
29
|
-
getTranslatedAnchor(connectable: GConnectableElement, refPoint: Point, refContainer: GParentElement, edge: GRoutableElement, anchorCorrection?: number | undefined): Point;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=routing-override.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routing-override.d.ts","sourceRoot":"","sources":["../src/routing-override.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EACH,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,IAAI,yBAAyB,EAC/C,gBAAgB,IAAI,uBAAuB,EAC3C,mBAAmB,IAAI,0BAA0B,EACjD,kBAAkB,IAAI,yBAAyB,EAClD,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErF,8BACsB,kBAAmB,SAAQ,yBAAyB;IAC7D,mBAAmB,CACxB,WAAW,EAAE,uBAAuB,EACpC,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,kBAAkB,EAChC,IAAI,EAAE,oBAAoB,EAC1B,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,GACtC,KAAK;CAKX;AAED,qBACa,kBAAmB,SAAQ,yBAAyB;IACpD,mBAAmB,CACxB,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,cAAc,EAC5B,IAAI,EAAE,gBAAgB,EACtB,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,GACtC,KAAK;CAKX;AAED,qBACa,mBAAoB,SAAQ,0BAA0B;IACtD,mBAAmB,CACxB,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,cAAc,EAC5B,IAAI,EAAE,gBAAgB,EACtB,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,GACtC,KAAK;CAKX;AAED,qBACa,gBAAiB,SAAQ,uBAAuB;IAChD,mBAAmB,CACxB,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,cAAc,EAC5B,IAAI,EAAE,gBAAgB,EACtB,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,GACtC,KAAK;CAKX"}
|