orcasvn-react-diagrams 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +15 -11
- package/dist/cjs/examples.js +857 -139
- package/dist/cjs/index.js +408 -41
- package/dist/cjs/types/api/types.d.ts +9 -0
- package/dist/cjs/types/displaybox/demos/labelStyleDemo.d.ts +2 -0
- package/dist/cjs/types/displaybox/demos/portPositionLimitsDemo.d.ts +2 -0
- package/dist/cjs/types/engine/DiagramEngine.d.ts +6 -0
- package/dist/cjs/types/engine/LinkRoutingService.d.ts +1 -1
- package/dist/cjs/types/renderer/konva/KonvaNodeFactory.d.ts +11 -0
- package/dist/cjs/types/renderer/konva/KonvaRenderer.d.ts +2 -0
- package/dist/cjs/types/strategies/ObstacleRouter.d.ts +2 -0
- package/dist/esm/examples.js +857 -139
- package/dist/esm/examples.js.map +1 -1
- package/dist/esm/index.js +408 -41
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/api/types.d.ts +9 -0
- package/dist/esm/types/displaybox/demos/labelStyleDemo.d.ts +2 -0
- package/dist/esm/types/displaybox/demos/portPositionLimitsDemo.d.ts +2 -0
- package/dist/esm/types/engine/DiagramEngine.d.ts +6 -0
- package/dist/esm/types/engine/LinkRoutingService.d.ts +1 -1
- package/dist/esm/types/renderer/konva/KonvaNodeFactory.d.ts +11 -0
- package/dist/esm/types/renderer/konva/KonvaRenderer.d.ts +2 -0
- package/dist/esm/types/strategies/ObstacleRouter.d.ts +2 -0
- package/dist/examples.d.ts +9 -0
- package/dist/index.d.ts +10 -1
- package/package.json +11 -11
- package/src/displaybox/demos/ObstacleRoutingDemoTab.tsx +11 -10
- package/src/displaybox/demos/index.tsx +27 -13
- package/src/displaybox/demos/labelStyleDemo.ts +101 -0
- package/src/displaybox/demos/obstacleRoutingDemo.ts +212 -176
- package/src/displaybox/demos/portPositionLimitsDemo.ts +211 -0
|
@@ -48,6 +48,14 @@ export type PortAnchorConstraint = {
|
|
|
48
48
|
preset: HostAnchorPreset;
|
|
49
49
|
fallback?: 'nearest';
|
|
50
50
|
};
|
|
51
|
+
export type PositionAxisLimit = {
|
|
52
|
+
min?: number;
|
|
53
|
+
max?: number;
|
|
54
|
+
};
|
|
55
|
+
export type PortPositionLimits = {
|
|
56
|
+
x?: PositionAxisLimit;
|
|
57
|
+
y?: PositionAxisLimit;
|
|
58
|
+
};
|
|
51
59
|
export type ResolvePortAnchorsOptions = {
|
|
52
60
|
preset: HostAnchorPreset;
|
|
53
61
|
};
|
|
@@ -158,6 +166,7 @@ export type ElementShapeHoverControlActivationEvent = {
|
|
|
158
166
|
export type ElementPortMovementPolicy = {
|
|
159
167
|
moveMode: MoveConstraint | 'anchors';
|
|
160
168
|
anchorConstraint?: PortAnchorConstraint;
|
|
169
|
+
positionLimits?: PortPositionLimits;
|
|
161
170
|
};
|
|
162
171
|
export type LinkRoutingMode = 'auto' | 'manual';
|
|
163
172
|
export type AnchorReference = 'top-left' | 'center';
|
|
@@ -115,12 +115,17 @@ export default class DiagramEngine {
|
|
|
115
115
|
private collectResizedElementSizes;
|
|
116
116
|
private resolveBorderPortResizeProjection;
|
|
117
117
|
private resolveConstrainedPortRelativePosition;
|
|
118
|
+
private applyPortPositionLimits;
|
|
119
|
+
private resolveBorderPositionWithLimits;
|
|
120
|
+
private isPointWithinPositionLimits;
|
|
121
|
+
private filterAnchorsByPositionLimits;
|
|
118
122
|
private resolveEffectivePortMoveMode;
|
|
119
123
|
private resolvePortAnchorsForElement;
|
|
120
124
|
private resolveNearestPortAnchor;
|
|
121
125
|
private findNearestPortAnchor;
|
|
122
126
|
private resolveAnchoredPortResizeProjection;
|
|
123
127
|
private resolveTextPresentation;
|
|
128
|
+
private resolveAllTextPresentationPatches;
|
|
124
129
|
private emitSelection;
|
|
125
130
|
private applyLayoutForParent;
|
|
126
131
|
private applyLayoutCascade;
|
|
@@ -132,6 +137,7 @@ export default class DiagramEngine {
|
|
|
132
137
|
private constrainPortToHostBorder;
|
|
133
138
|
private projectPointToHostBorder;
|
|
134
139
|
private routeLinksWithEmptyPoints;
|
|
140
|
+
private normalizePortsForHostPolicies;
|
|
135
141
|
private computeRemovalDiff;
|
|
136
142
|
private emitEntityDeletionEvents;
|
|
137
143
|
}
|
|
@@ -34,7 +34,7 @@ export default class LinkRoutingService {
|
|
|
34
34
|
private getElementRect;
|
|
35
35
|
private resolveHostForPort;
|
|
36
36
|
private resolveAttachModeForPorts;
|
|
37
|
-
private
|
|
37
|
+
private isAncestorOf;
|
|
38
38
|
private getAncestorChain;
|
|
39
39
|
private getAncestorExclusions;
|
|
40
40
|
private resolveRouteBounds;
|
|
@@ -36,6 +36,17 @@ export default class KonvaNodeFactory {
|
|
|
36
36
|
createPortNode(model: PortData): KonvaNodeLike;
|
|
37
37
|
createLinkNode(model: LinkData): KonvaNodeLike;
|
|
38
38
|
createTextNode(model: TextData): KonvaNodeLike;
|
|
39
|
+
createTextBackgroundNode(config: {
|
|
40
|
+
id: string;
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
fill: string;
|
|
46
|
+
stroke?: string;
|
|
47
|
+
strokeWidth?: number;
|
|
48
|
+
cornerRadius?: number | [number, number, number, number];
|
|
49
|
+
}): KonvaNodeLike;
|
|
39
50
|
createHandleNode(config: {
|
|
40
51
|
id: string;
|
|
41
52
|
x: number;
|
|
@@ -61,6 +61,7 @@ export default class KonvaRenderer implements Renderer {
|
|
|
61
61
|
private portNodes;
|
|
62
62
|
private linkNodes;
|
|
63
63
|
private textNodes;
|
|
64
|
+
private textBackgroundNodes;
|
|
64
65
|
private selectedIds;
|
|
65
66
|
private overlayLayer;
|
|
66
67
|
private tempLinkNode;
|
|
@@ -118,6 +119,7 @@ export default class KonvaRenderer implements Renderer {
|
|
|
118
119
|
private syncPorts;
|
|
119
120
|
private syncLinks;
|
|
120
121
|
private syncTexts;
|
|
122
|
+
private resolveTextBackgroundMeta;
|
|
121
123
|
private updatePosition;
|
|
122
124
|
private applyPortOrientation;
|
|
123
125
|
private resolveHostElement;
|
|
@@ -16,6 +16,8 @@ export default class ObstacleRouter implements RouterStrategy {
|
|
|
16
16
|
private pointsWithinBounds;
|
|
17
17
|
private isPathClear;
|
|
18
18
|
private computeStubEndpoint;
|
|
19
|
+
private computeAvailableStubLength;
|
|
20
|
+
private rectsEqual;
|
|
19
21
|
private getNormal;
|
|
20
22
|
private distanceToBounds;
|
|
21
23
|
private distanceToObstacles;
|