@eclipse-glsp/client 1.1.0-RC02 → 1.1.0-next.0d35bd0.205
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/base/action-dispatcher.js.map +1 -1
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/container-modules.js +37 -36
- package/lib/base/container-modules.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +1 -1
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/focus-tracker.js.map +1 -1
- package/lib/base/model/model-registry.js.map +1 -1
- package/lib/base/model/update-model-command.js.map +1 -1
- package/lib/base/model-initialization-constraint.js.map +1 -1
- package/lib/base/selection-clearing-mouse-listener.js.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
- package/lib/base/view/view-registry.js.map +1 -1
- package/lib/features/bounds/di.config.d.ts +20 -0
- package/lib/features/bounds/di.config.d.ts.map +1 -0
- package/lib/features/bounds/di.config.js +36 -0
- package/lib/features/bounds/di.config.js.map +1 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +34 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +98 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -0
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/change-bounds/snap.js.map +1 -1
- package/lib/features/command-palette/command-palette-tool.js.map +1 -1
- package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
- package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
- package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/decoration/decoration-placer.js.map +1 -1
- package/lib/features/edit-label/edit-label-tool.js.map +1 -1
- package/lib/features/edit-label/edit-label-validator.js.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/hints/type-hints.js.map +1 -1
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/layout/freeform-layout.js.map +1 -1
- package/lib/features/layout/hbox-layout.js.map +1 -1
- package/lib/features/layout/layout-elements-action.d.ts +4 -4
- package/lib/features/layout/layout-elements-action.d.ts.map +1 -1
- package/lib/features/layout/layout-elements-action.js.map +1 -1
- package/lib/features/layout/layouter.js.map +1 -1
- package/lib/features/layout/vbox-layout.js.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.d.ts +1 -1
- package/lib/features/mouse-tool/mouse-tool.d.ts.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/features/select/select-feedback-action.js.map +1 -1
- package/lib/features/select/selection-service.js.map +1 -1
- package/lib/features/source-model-watcher/source-model-changed-action-handler.js.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/css-feedback.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/features/tool-feedback/marquee-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/view.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/base-glsp-tool.js.map +1 -1
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/delete-tool.js.map +1 -1
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +3 -0
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/enable-default-tools-on-focus-loss.js.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts +20 -0
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -0
- package/lib/features/tools/glsp-manhattan-edge-router.js +69 -0
- package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -0
- package/lib/features/tools/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/marquee-tool.js.map +1 -1
- package/lib/features/tools/node-creation-tool.js.map +1 -1
- package/lib/features/tools/view.js.map +1 -1
- package/lib/features/validation/marker-navigator.d.ts +1 -1
- package/lib/features/validation/marker-navigator.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
- package/lib/model-source/glsp-diagram-server.js.map +1 -1
- package/lib/utils/smodel-util.d.ts +27 -6
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +40 -7
- package/lib/utils/smodel-util.js.map +1 -1
- package/lib/views/compartments.js.map +1 -1
- package/lib/views/glsp-edge-view.js.map +1 -1
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/lib/views/issue-marker-view.js.map +1 -1
- package/lib/views/rounded-corner-view.js.map +1 -1
- package/package.json +9 -11
- package/src/base/container-modules.ts +2 -2
- package/src/features/bounds/di.config.ts +39 -0
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +88 -0
- package/src/features/tools/di.config.ts +5 -1
- package/src/features/tools/glsp-manhattan-edge-router.ts +57 -0
- package/src/utils/smodel-util.ts +48 -11
package/src/utils/smodel-util.ts
CHANGED
|
@@ -13,15 +13,18 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
distinctAdd, ElementAndBounds, ElementAndRoutingPoints, Point, remove, SModelElementSchema,
|
|
18
|
+
TypeGuard
|
|
19
|
+
} from '@eclipse-glsp/protocol';
|
|
17
20
|
import {
|
|
18
21
|
BoundsAware,
|
|
19
22
|
EdgeRouterRegistry,
|
|
20
23
|
isBoundsAware,
|
|
21
24
|
isMoveable,
|
|
22
25
|
isSelectable,
|
|
23
|
-
isSelected,
|
|
24
|
-
|
|
26
|
+
isSelected, ModelIndexImpl,
|
|
27
|
+
RoutedPoint,
|
|
25
28
|
Selectable,
|
|
26
29
|
SModelElement,
|
|
27
30
|
SRoutableElement,
|
|
@@ -226,21 +229,55 @@ export function toElementAndRoutingPoints(element: SRoutableElement): ElementAnd
|
|
|
226
229
|
};
|
|
227
230
|
}
|
|
228
231
|
|
|
232
|
+
/** Pure routing point data kinds. */
|
|
233
|
+
export const ROUTING_POINT_KINDS = ['linear', 'bezier-junction'];
|
|
234
|
+
|
|
235
|
+
/** Pure route data kinds. */
|
|
236
|
+
export const ROUTE_KINDS = [...ROUTING_POINT_KINDS, 'source', 'target'];
|
|
237
|
+
|
|
229
238
|
/**
|
|
230
239
|
* Helper function to calculate the {@link ElementAndRoutingPoints} for a given {@link SRoutableElement}.
|
|
231
240
|
* If client layout is activated, i.e., the edge routing registry is given and has a router for the element, then the routing
|
|
232
241
|
* points from the calculated route are used, otherwise we use the already specified routing points of the {@link SRoutableElement}.
|
|
233
242
|
* @param element The element to translate.
|
|
234
|
-
* @param
|
|
243
|
+
* @param routerRegistry the edge router registry.
|
|
235
244
|
* @returns The corresponding {@link ElementAndRoutingPoints} for the given element.
|
|
236
245
|
*/
|
|
237
|
-
export function calcElementAndRoutingPoints(element: SRoutableElement,
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
246
|
+
export function calcElementAndRoutingPoints(element: SRoutableElement, routerRegistry?: EdgeRouterRegistry): ElementAndRoutingPoints {
|
|
247
|
+
const newRoutingPoints = routerRegistry ? calcRoute(element, routerRegistry, ROUTING_POINT_KINDS) : element.routingPoints;
|
|
248
|
+
return { elementId: element.id, newRoutingPoints };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Helper function to calculate the route for a given {@link SRoutableElement}.
|
|
253
|
+
* If client layout is activated, i.e., the edge routing registry is given and has a router for the element, then the points
|
|
254
|
+
* from the calculated route are used, otherwise we use the already specified routing points of the {@link SRoutableElement}.
|
|
255
|
+
* @param element The element to translate.
|
|
256
|
+
* @param routerRegistry the edge router registry.
|
|
257
|
+
* @returns The corresponding route for the given element.
|
|
258
|
+
*/
|
|
259
|
+
export function calcElementAndRoute(element: SRoutableElement, routerRegistry?: EdgeRouterRegistry): ElementAndRoutingPoints {
|
|
260
|
+
let route: Point[] | undefined = routerRegistry ? calcRoute(element, routerRegistry, ROUTE_KINDS) : undefined;
|
|
261
|
+
if (!route) {
|
|
262
|
+
// add source and target to the routing points
|
|
263
|
+
route = [...element.routingPoints];
|
|
264
|
+
route.splice(0, 0, element.source?.position || Point.ORIGIN);
|
|
265
|
+
route.push(element.target?.position || Point.ORIGIN);
|
|
266
|
+
}
|
|
267
|
+
return { elementId: element.id, newRoutingPoints: route };
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Helper function to calculate the route for a given {@link SRoutableElement}.
|
|
272
|
+
* @param element The element to translate.
|
|
273
|
+
* @param routerRegistry the edge router registry.
|
|
274
|
+
* @param pointKinds the routing point kinds that should be considered.
|
|
275
|
+
* @returns The corresponding route for the given element.
|
|
276
|
+
*/
|
|
277
|
+
export function calcRoute(element: SRoutableElement, routerRegistry: EdgeRouterRegistry, pointKinds?: string[]): RoutedPoint[] | undefined {
|
|
278
|
+
return routerRegistry?.get(element.routerKind).route(element)
|
|
279
|
+
.filter((point, idx, fullRoute) => idx === fullRoute.findIndex(otherPoint => otherPoint.x === point.x && otherPoint.y === point.y))
|
|
280
|
+
.filter(point => !pointKinds || pointKinds.includes(point.kind));
|
|
244
281
|
}
|
|
245
282
|
|
|
246
283
|
/**
|