@likec4/diagram 1.27.0 → 1.27.2
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/bundle/index.js +2343 -6880
- package/dist/LikeC4Diagram.js +3 -9
- package/dist/LikeC4Diagram.props.d.ts +5 -3
- package/dist/StaticLikeC4Diagram.js +1 -1
- package/dist/_virtual/set.js +5 -0
- package/dist/_virtual/set2.js +3 -0
- package/dist/base/BaseXYFlow.d.ts +2 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -2
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -4
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.js +0 -3
- package/dist/base/primitives/edge/edge.css.js +2 -0
- package/dist/base/primitives/element/ElementActionButtons.js +5 -10
- package/dist/base/primitives/element/ElementNodeContainer.css.js +5 -4
- package/dist/base/primitives/element/ElementShape.css.js +1 -12
- package/dist/base/primitives/element/ElementTitle.css.js +3 -2
- package/dist/base/types.js +2 -2
- package/dist/base/updateEdges.js +1 -9
- package/dist/base/updateNodes.js +1 -12
- package/dist/bundle/LikeC4View.js +2 -2
- package/dist/bundle/LikeC4View.props.d.ts +7 -7
- package/dist/components/Link.js +1 -1
- package/dist/hooks/useCurrentViewId.js +8 -2
- package/dist/hooks/useDiagram.d.ts +2659 -1996
- package/dist/hooks/useDiagram.js +16 -8
- package/dist/likec4diagram/DiagramXYFlow.js +10 -9
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +30 -41
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +6 -1
- package/dist/likec4diagram/ui/controls/LayoutDriftNotification.js +13 -5
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +3 -3
- package/dist/likec4diagram/ui/notation/NotationPanel.js +10 -4
- package/dist/likec4diagram/useLayoutConstraints.d.ts +11 -10
- package/dist/likec4diagram/useLayoutConstraints.js +64 -61
- package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +369 -0
- package/dist/overlays/Overlays.js +5 -3
- package/dist/overlays/element-details/actor.d.ts +2769 -173
- package/dist/overlays/overlay/Overlay.css.d.ts +26 -2
- package/dist/overlays/overlay/Overlay.css.js +83 -16
- package/dist/overlays/overlay/Overlay.d.ts +7 -6
- package/dist/overlays/overlay/Overlay.js +39 -32
- package/dist/overlays/overlaysActor.js +2 -2
- package/dist/overlays/relationship-details/RelationshipDetails.js +113 -70
- package/dist/overlays/relationship-details/SelectEdge.d.ts +1 -1
- package/dist/overlays/relationship-details/SelectEdge.js +15 -9
- package/dist/overlays/relationship-details/_types.d.ts +4 -1
- package/dist/overlays/relationship-details/actor.d.ts +415 -128
- package/dist/overlays/relationship-details/actor.js +162 -53
- package/dist/overlays/relationship-details/compute.d.ts +12 -0
- package/dist/overlays/relationship-details/compute.js +139 -0
- package/dist/overlays/relationship-details/custom/ElementActions.js +27 -5
- package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +2 -1
- package/dist/overlays/relationship-details/hooks.d.ts +336 -6
- package/dist/overlays/relationship-details/hooks.js +9 -7
- package/dist/overlays/relationship-details/layout-to-xyflow.d.ts +12 -0
- package/dist/overlays/relationship-details/layout-to-xyflow.js +149 -0
- package/dist/overlays/relationship-details/layout.d.ts +22 -0
- package/dist/overlays/relationship-details/layout.js +314 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +3 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.js +4 -4
- package/dist/overlays/relationships-browser/_types.d.ts +2 -0
- package/dist/overlays/relationships-browser/actor.d.ts +130 -14
- package/dist/overlays/relationships-browser/actor.js +30 -16
- package/dist/overlays/relationships-browser/custom/ElementActions.js +5 -3
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +3 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +1 -1
- package/dist/overlays/relationships-browser/hooks.d.ts +3 -1
- package/dist/overlays/relationships-browser/hooks.js +1 -1
- package/dist/overlays/relationships-browser/{-useRelationshipsView.d.ts → layout.d.ts} +2 -0
- package/dist/overlays/relationships-browser/{-useRelationshipsView.js → layout.js} +19 -2
- package/dist/overlays/relationships-browser/useViewToNodesEdges.d.ts +1 -1
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +3 -1
- package/dist/packages/core/src/compute-view/relationships-view/compute.js +1 -1
- package/dist/packages/core/src/model/connection/model/ConnectionModel.js +121 -0
- package/dist/packages/core/src/model/connection/model/find.js +39 -0
- package/dist/packages/core/src/model/connection/ops.js +7 -0
- package/dist/packages/core/src/utils/const.js +3 -0
- package/dist/packages/core/src/utils/fqn.js +9 -1
- package/dist/packages/core/src/utils/iterable/find.js +21 -0
- package/dist/packages/core/src/utils/iterable/some.js +21 -0
- package/dist/packages/core/src/utils/set.js +48 -0
- package/dist/packages/core/src/utils/string-hash.js +13 -0
- package/dist/state/DiagramActorProvider.d.ts +4 -2
- package/dist/state/DiagramActorProvider.js +30 -37
- package/dist/state/assign.js +2 -2
- package/dist/state/diagram-machine.d.ts +1731 -1040
- package/dist/state/diagram-machine.js +126 -60
- package/dist/state/syncManualLayoutActor.d.ts +1 -1
- package/dist/styles.css.js +1 -1
- package/package.json +11 -11
- package/src/LikeC4Diagram.props.ts +7 -3
- package/src/LikeC4Diagram.tsx +2 -8
- package/src/StaticLikeC4Diagram.tsx +1 -1
- package/src/base/BaseXYFlow.tsx +2 -1
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -3
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -4
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgePath.tsx +0 -3
- package/src/base/primitives/edge/edge.css.ts +2 -0
- package/src/base/primitives/element/ElementActionButtons.tsx +6 -7
- package/src/base/primitives/element/ElementNodeContainer.css.ts +5 -4
- package/src/base/primitives/element/ElementShape.css.ts +1 -12
- package/src/base/primitives/element/ElementTitle.css.ts +3 -2
- package/src/base/types.ts +2 -7
- package/src/base/updateEdges.ts +8 -8
- package/src/base/updateNodes.ts +11 -11
- package/src/bundle/LikeC4View.props.ts +7 -7
- package/src/bundle/LikeC4View.tsx +2 -2
- package/src/components/Link.tsx +3 -1
- package/src/hooks/useCurrentViewId.ts +4 -2
- package/src/hooks/useDiagram.ts +18 -9
- package/src/likec4diagram/DiagramXYFlow.tsx +11 -9
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +39 -48
- package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +2 -2
- package/src/likec4diagram/custom/nodes/toolbar/styles.css.ts +5 -0
- package/src/likec4diagram/ui/controls/LayoutDriftNotification.tsx +8 -4
- package/src/likec4diagram/ui/notation/NotationPanel.css.ts +2 -2
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +8 -6
- package/src/likec4diagram/useLayoutConstraints.ts +84 -89
- package/src/overlays/Overlays.tsx +5 -3
- package/src/overlays/overlay/Overlay.css.ts +83 -15
- package/src/overlays/overlay/Overlay.tsx +52 -41
- package/src/overlays/overlaysActor.ts +1 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +131 -68
- package/src/overlays/relationship-details/SelectEdge.tsx +19 -12
- package/src/overlays/relationship-details/_types.ts +3 -1
- package/src/overlays/relationship-details/actor.ts +217 -68
- package/src/overlays/relationship-details/compute.ts +186 -0
- package/src/overlays/relationship-details/custom/ElementActions.tsx +27 -18
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
- package/src/overlays/relationship-details/hooks.ts +10 -8
- package/src/overlays/relationship-details/layout-to-xyflow.ts +195 -0
- package/src/overlays/relationship-details/layout.ts +470 -0
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +2 -2
- package/src/overlays/relationships-browser/SelectElement.tsx +5 -5
- package/src/overlays/relationships-browser/_types.ts +2 -0
- package/src/overlays/relationships-browser/actor.ts +39 -14
- package/src/overlays/relationships-browser/custom/ElementActions.tsx +5 -3
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/hooks.ts +2 -2
- package/src/overlays/relationships-browser/{-useRelationshipsView.ts → layout.ts} +23 -13
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +3 -1
- package/src/state/DiagramActorProvider.tsx +40 -50
- package/src/state/assign.ts +2 -2
- package/src/state/diagram-machine.ts +151 -75
- package/dist/overlays/relationship-details/useLayoutedDetails.d.ts +0 -19
- package/dist/overlays/relationship-details/useLayoutedDetails.js +0 -267
- package/src/overlays/relationship-details/useLayoutedDetails.ts +0 -376
|
@@ -2,8 +2,8 @@ import { BBox, Fqn, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineTy
|
|
|
2
2
|
import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
3
3
|
import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, PromiseActorLogic, EventObject, StateMachine, Values, NonReducibleUnknown, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, CancelAction, DoneActorEvent } from 'xstate';
|
|
4
4
|
import { Base } from '../../base';
|
|
5
|
-
import { LayoutRelationshipsViewResult } from './-useRelationshipsView';
|
|
6
5
|
import { RelationshipsBrowserTypes } from './_types';
|
|
6
|
+
import { LayoutRelationshipsViewResult } from './layout';
|
|
7
7
|
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
8
8
|
import { ReactNode, CSSProperties } from 'react';
|
|
9
9
|
type XYFLowInstance = ReactFlowInstance<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>;
|
|
@@ -156,10 +156,6 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
156
156
|
type: "update.view";
|
|
157
157
|
params: NonReducibleUnknown;
|
|
158
158
|
};
|
|
159
|
-
"xyflow:updateNodeInternals": {
|
|
160
|
-
type: "xyflow:updateNodeInternals";
|
|
161
|
-
params: unknown;
|
|
162
|
-
};
|
|
163
159
|
"xyflow:fitDiagram": {
|
|
164
160
|
type: "xyflow:fitDiagram";
|
|
165
161
|
params: {
|
|
@@ -167,16 +163,24 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
167
163
|
bounds?: BBox;
|
|
168
164
|
} | undefined;
|
|
169
165
|
};
|
|
166
|
+
"xyflow:updateNodeInternals": {
|
|
167
|
+
type: "xyflow:updateNodeInternals";
|
|
168
|
+
params: unknown;
|
|
169
|
+
};
|
|
170
170
|
}>, Values<{
|
|
171
171
|
isReady: {
|
|
172
172
|
type: "isReady";
|
|
173
173
|
params: unknown;
|
|
174
174
|
};
|
|
175
|
+
hasViewId: {
|
|
176
|
+
type: "hasViewId";
|
|
177
|
+
params: unknown;
|
|
178
|
+
};
|
|
175
179
|
anotherSubject: {
|
|
176
180
|
type: "anotherSubject";
|
|
177
181
|
params: unknown;
|
|
178
182
|
};
|
|
179
|
-
}>, never, "
|
|
183
|
+
}>, never, "closed" | "isReady" | "initializing" | {
|
|
180
184
|
active: "idle" | "layouting";
|
|
181
185
|
}, "active", Input, NonReducibleUnknown, EventObject, MetaObject, {
|
|
182
186
|
readonly id: "relationships-browser";
|
|
@@ -213,6 +217,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
213
217
|
focusable?: boolean;
|
|
214
218
|
type: "relationship";
|
|
215
219
|
data: {
|
|
220
|
+
sourceFqn: Fqn;
|
|
221
|
+
targetFqn: Fqn;
|
|
216
222
|
relations: NonEmptyArray<RelationId>;
|
|
217
223
|
color: Color | undefined;
|
|
218
224
|
label: string | null;
|
|
@@ -264,6 +270,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
264
270
|
focusable?: boolean;
|
|
265
271
|
type: "relationship";
|
|
266
272
|
data: {
|
|
273
|
+
sourceFqn: Fqn;
|
|
274
|
+
targetFqn: Fqn;
|
|
267
275
|
relations: NonEmptyArray<RelationId>;
|
|
268
276
|
color: Color | undefined;
|
|
269
277
|
label: string | null;
|
|
@@ -322,6 +330,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
322
330
|
focusable?: boolean;
|
|
323
331
|
type: "relationship";
|
|
324
332
|
data: {
|
|
333
|
+
sourceFqn: Fqn;
|
|
334
|
+
targetFqn: Fqn;
|
|
325
335
|
relations: NonEmptyArray<RelationId>;
|
|
326
336
|
color: Color | undefined;
|
|
327
337
|
label: string | null;
|
|
@@ -481,10 +491,80 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
481
491
|
type: "update.view";
|
|
482
492
|
params: NonReducibleUnknown;
|
|
483
493
|
};
|
|
494
|
+
"xyflow:fitDiagram": {
|
|
495
|
+
type: "xyflow:fitDiagram";
|
|
496
|
+
params: {
|
|
497
|
+
duration?: number;
|
|
498
|
+
bounds?: BBox;
|
|
499
|
+
} | undefined;
|
|
500
|
+
};
|
|
484
501
|
"xyflow:updateNodeInternals": {
|
|
485
502
|
type: "xyflow:updateNodeInternals";
|
|
486
503
|
params: unknown;
|
|
487
504
|
};
|
|
505
|
+
}>, Values<{
|
|
506
|
+
isReady: {
|
|
507
|
+
type: "isReady";
|
|
508
|
+
params: unknown;
|
|
509
|
+
};
|
|
510
|
+
hasViewId: {
|
|
511
|
+
type: "hasViewId";
|
|
512
|
+
params: unknown;
|
|
513
|
+
};
|
|
514
|
+
anotherSubject: {
|
|
515
|
+
type: "anotherSubject";
|
|
516
|
+
params: unknown;
|
|
517
|
+
};
|
|
518
|
+
}>, never, EventObject>;
|
|
519
|
+
};
|
|
520
|
+
readonly 'xyflow.edgeClick': {
|
|
521
|
+
readonly guard: "hasViewId";
|
|
522
|
+
readonly actions: ActionFunction<Readonly<{
|
|
523
|
+
subject: Fqn;
|
|
524
|
+
viewId: ViewId | null;
|
|
525
|
+
scope: "global" | "view";
|
|
526
|
+
closeable: boolean;
|
|
527
|
+
enableSelectSubject: boolean;
|
|
528
|
+
enableChangeScope: boolean;
|
|
529
|
+
xyflow: XYFLowInstance | null;
|
|
530
|
+
xystore: XYStoreApi | null;
|
|
531
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
532
|
+
navigateFromNode: string | null;
|
|
533
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
534
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
535
|
+
}>, {
|
|
536
|
+
type: "xyflow.edgeClick";
|
|
537
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
538
|
+
}, Events, undefined, {
|
|
539
|
+
src: "layouter";
|
|
540
|
+
logic: PromiseActorLogic<{
|
|
541
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
542
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
543
|
+
}, {
|
|
544
|
+
subjectId: Fqn;
|
|
545
|
+
navigateFromNode: string | null;
|
|
546
|
+
xyflow: XYFLowInstance;
|
|
547
|
+
xystore: XYStoreApi;
|
|
548
|
+
update: LayoutRelationshipsViewResult;
|
|
549
|
+
}, EventObject>;
|
|
550
|
+
id: "layouter";
|
|
551
|
+
}, Values<{
|
|
552
|
+
"xyflow.init": {
|
|
553
|
+
type: "xyflow.init";
|
|
554
|
+
params: NonReducibleUnknown;
|
|
555
|
+
};
|
|
556
|
+
"xyflow.applyNodeChanges": {
|
|
557
|
+
type: "xyflow.applyNodeChanges";
|
|
558
|
+
params: NonReducibleUnknown;
|
|
559
|
+
};
|
|
560
|
+
"xyflow.applyEdgeChanges": {
|
|
561
|
+
type: "xyflow.applyEdgeChanges";
|
|
562
|
+
params: NonReducibleUnknown;
|
|
563
|
+
};
|
|
564
|
+
"update.view": {
|
|
565
|
+
type: "update.view";
|
|
566
|
+
params: NonReducibleUnknown;
|
|
567
|
+
};
|
|
488
568
|
"xyflow:fitDiagram": {
|
|
489
569
|
type: "xyflow:fitDiagram";
|
|
490
570
|
params: {
|
|
@@ -492,11 +572,19 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
492
572
|
bounds?: BBox;
|
|
493
573
|
} | undefined;
|
|
494
574
|
};
|
|
575
|
+
"xyflow:updateNodeInternals": {
|
|
576
|
+
type: "xyflow:updateNodeInternals";
|
|
577
|
+
params: unknown;
|
|
578
|
+
};
|
|
495
579
|
}>, Values<{
|
|
496
580
|
isReady: {
|
|
497
581
|
type: "isReady";
|
|
498
582
|
params: unknown;
|
|
499
583
|
};
|
|
584
|
+
hasViewId: {
|
|
585
|
+
type: "hasViewId";
|
|
586
|
+
params: unknown;
|
|
587
|
+
};
|
|
500
588
|
anotherSubject: {
|
|
501
589
|
type: "anotherSubject";
|
|
502
590
|
params: unknown;
|
|
@@ -623,6 +711,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
623
711
|
focusable?: boolean;
|
|
624
712
|
type: "relationship";
|
|
625
713
|
data: {
|
|
714
|
+
sourceFqn: Fqn;
|
|
715
|
+
targetFqn: Fqn;
|
|
626
716
|
relations: NonEmptyArray<RelationId>;
|
|
627
717
|
color: Color | undefined;
|
|
628
718
|
label: string | null;
|
|
@@ -945,10 +1035,6 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
945
1035
|
type: "update.view";
|
|
946
1036
|
params: NonReducibleUnknown;
|
|
947
1037
|
};
|
|
948
|
-
"xyflow:updateNodeInternals": {
|
|
949
|
-
type: "xyflow:updateNodeInternals";
|
|
950
|
-
params: unknown;
|
|
951
|
-
};
|
|
952
1038
|
"xyflow:fitDiagram": {
|
|
953
1039
|
type: "xyflow:fitDiagram";
|
|
954
1040
|
params: {
|
|
@@ -956,11 +1042,19 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
956
1042
|
bounds?: BBox;
|
|
957
1043
|
} | undefined;
|
|
958
1044
|
};
|
|
1045
|
+
"xyflow:updateNodeInternals": {
|
|
1046
|
+
type: "xyflow:updateNodeInternals";
|
|
1047
|
+
params: unknown;
|
|
1048
|
+
};
|
|
959
1049
|
}>, Values<{
|
|
960
1050
|
isReady: {
|
|
961
1051
|
type: "isReady";
|
|
962
1052
|
params: unknown;
|
|
963
1053
|
};
|
|
1054
|
+
hasViewId: {
|
|
1055
|
+
type: "hasViewId";
|
|
1056
|
+
params: unknown;
|
|
1057
|
+
};
|
|
964
1058
|
anotherSubject: {
|
|
965
1059
|
type: "anotherSubject";
|
|
966
1060
|
params: unknown;
|
|
@@ -1034,6 +1128,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1034
1128
|
focusable?: boolean;
|
|
1035
1129
|
type: "relationship";
|
|
1036
1130
|
data: {
|
|
1131
|
+
sourceFqn: Fqn;
|
|
1132
|
+
targetFqn: Fqn;
|
|
1037
1133
|
relations: NonEmptyArray<RelationId>;
|
|
1038
1134
|
color: Color | undefined;
|
|
1039
1135
|
label: string | null;
|
|
@@ -1076,6 +1172,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1076
1172
|
focusable?: boolean;
|
|
1077
1173
|
type: "relationship";
|
|
1078
1174
|
data: {
|
|
1175
|
+
sourceFqn: Fqn;
|
|
1176
|
+
targetFqn: Fqn;
|
|
1079
1177
|
relations: NonEmptyArray<RelationId>;
|
|
1080
1178
|
color: Color | undefined;
|
|
1081
1179
|
label: string | null;
|
|
@@ -1115,6 +1213,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1115
1213
|
focusable?: boolean;
|
|
1116
1214
|
type: "relationship";
|
|
1117
1215
|
data: {
|
|
1216
|
+
sourceFqn: Fqn;
|
|
1217
|
+
targetFqn: Fqn;
|
|
1118
1218
|
relations: NonEmptyArray<RelationId>;
|
|
1119
1219
|
color: Color | undefined;
|
|
1120
1220
|
label: string | null;
|
|
@@ -1153,6 +1253,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1153
1253
|
focusable?: boolean;
|
|
1154
1254
|
type: "relationship";
|
|
1155
1255
|
data: {
|
|
1256
|
+
sourceFqn: Fqn;
|
|
1257
|
+
targetFqn: Fqn;
|
|
1156
1258
|
relations: NonEmptyArray<RelationId>;
|
|
1157
1259
|
color: Color | undefined;
|
|
1158
1260
|
label: string | null;
|
|
@@ -1191,6 +1293,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1191
1293
|
focusable?: boolean;
|
|
1192
1294
|
type: "relationship";
|
|
1193
1295
|
data: {
|
|
1296
|
+
sourceFqn: Fqn;
|
|
1297
|
+
targetFqn: Fqn;
|
|
1194
1298
|
relations: NonEmptyArray<RelationId>;
|
|
1195
1299
|
color: Color | undefined;
|
|
1196
1300
|
label: string | null;
|
|
@@ -1229,6 +1333,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1229
1333
|
focusable?: boolean;
|
|
1230
1334
|
type: "relationship";
|
|
1231
1335
|
data: {
|
|
1336
|
+
sourceFqn: Fqn;
|
|
1337
|
+
targetFqn: Fqn;
|
|
1232
1338
|
relations: NonEmptyArray<RelationId>;
|
|
1233
1339
|
color: Color | undefined;
|
|
1234
1340
|
label: string | null;
|
|
@@ -1267,6 +1373,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1267
1373
|
focusable?: boolean;
|
|
1268
1374
|
type: "relationship";
|
|
1269
1375
|
data: {
|
|
1376
|
+
sourceFqn: Fqn;
|
|
1377
|
+
targetFqn: Fqn;
|
|
1270
1378
|
relations: NonEmptyArray<RelationId>;
|
|
1271
1379
|
color: Color | undefined;
|
|
1272
1380
|
label: string | null;
|
|
@@ -1306,6 +1414,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1306
1414
|
focusable?: boolean;
|
|
1307
1415
|
type: "relationship";
|
|
1308
1416
|
data: {
|
|
1417
|
+
sourceFqn: Fqn;
|
|
1418
|
+
targetFqn: Fqn;
|
|
1309
1419
|
relations: NonEmptyArray<RelationId>;
|
|
1310
1420
|
color: Color | undefined;
|
|
1311
1421
|
label: string | null;
|
|
@@ -1344,6 +1454,8 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1344
1454
|
focusable?: boolean;
|
|
1345
1455
|
type: "relationship";
|
|
1346
1456
|
data: {
|
|
1457
|
+
sourceFqn: Fqn;
|
|
1458
|
+
targetFqn: Fqn;
|
|
1347
1459
|
relations: NonEmptyArray<RelationId>;
|
|
1348
1460
|
color: Color | undefined;
|
|
1349
1461
|
label: string | null;
|
|
@@ -1406,10 +1518,6 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1406
1518
|
type: "update.view";
|
|
1407
1519
|
params: NonReducibleUnknown;
|
|
1408
1520
|
};
|
|
1409
|
-
"xyflow:updateNodeInternals": {
|
|
1410
|
-
type: "xyflow:updateNodeInternals";
|
|
1411
|
-
params: unknown;
|
|
1412
|
-
};
|
|
1413
1521
|
"xyflow:fitDiagram": {
|
|
1414
1522
|
type: "xyflow:fitDiagram";
|
|
1415
1523
|
params: {
|
|
@@ -1417,11 +1525,19 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1417
1525
|
bounds?: BBox;
|
|
1418
1526
|
} | undefined;
|
|
1419
1527
|
};
|
|
1528
|
+
"xyflow:updateNodeInternals": {
|
|
1529
|
+
type: "xyflow:updateNodeInternals";
|
|
1530
|
+
params: unknown;
|
|
1531
|
+
};
|
|
1420
1532
|
}>, Values<{
|
|
1421
1533
|
isReady: {
|
|
1422
1534
|
type: "isReady";
|
|
1423
1535
|
params: unknown;
|
|
1424
1536
|
};
|
|
1537
|
+
hasViewId: {
|
|
1538
|
+
type: "hasViewId";
|
|
1539
|
+
params: unknown;
|
|
1540
|
+
};
|
|
1425
1541
|
anotherSubject: {
|
|
1426
1542
|
type: "anotherSubject";
|
|
1427
1543
|
params: unknown;
|
|
@@ -6,6 +6,7 @@ import { setup, assign, fromPromise, assertEvent, enqueueActions, cancel, raise
|
|
|
6
6
|
import { MinZoom, ZIndexes } from '../../base/const.js';
|
|
7
7
|
import { updateEdges } from '../../base/updateEdges.js';
|
|
8
8
|
import { updateNodes } from '../../base/updateNodes.js';
|
|
9
|
+
import { typedSystem } from '../../state/utils.js';
|
|
9
10
|
import { ViewPadding } from './const.js';
|
|
10
11
|
import { viewToNodesEdge } from './useViewToNodesEdges.js';
|
|
11
12
|
import { Base } from '../../base/types.js';
|
|
@@ -129,6 +130,7 @@ const relationshipsBrowserLogic = setup({
|
|
|
129
130
|
layouter
|
|
130
131
|
},
|
|
131
132
|
guards: {
|
|
133
|
+
hasViewId: ({ context }) => context.viewId !== null,
|
|
132
134
|
isReady: ({ context }) => context.xyflow !== null && context.xystore !== null && context.layouted !== null,
|
|
133
135
|
anotherSubject: ({ context, event }) => {
|
|
134
136
|
if (event.type === "update.view") {
|
|
@@ -271,10 +273,24 @@ const relationshipsBrowserLogic = setup({
|
|
|
271
273
|
}
|
|
272
274
|
})
|
|
273
275
|
},
|
|
276
|
+
"xyflow.edgeClick": {
|
|
277
|
+
guard: "hasViewId",
|
|
278
|
+
actions: enqueueActions(({ event, context, system, enqueue }) => {
|
|
279
|
+
if (event.edge.selected || event.edge.data.relations.length > 1) {
|
|
280
|
+
enqueue.sendTo(typedSystem(system).overlaysActorRef, {
|
|
281
|
+
type: "open.relationshipDetails",
|
|
282
|
+
viewId: context.viewId,
|
|
283
|
+
source: event.edge.data.sourceFqn,
|
|
284
|
+
target: event.edge.data.targetFqn
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
},
|
|
274
289
|
"navigate.to": {
|
|
275
290
|
actions: [
|
|
276
291
|
assign({
|
|
277
292
|
subject: ({ event }) => event.subject,
|
|
293
|
+
viewId: ({ event, context }) => event.viewId ?? context.viewId ?? null,
|
|
278
294
|
navigateFromNode: ({ event }) => event.fromNode ?? null
|
|
279
295
|
})
|
|
280
296
|
]
|
|
@@ -321,7 +337,7 @@ const relationshipsBrowserLogic = setup({
|
|
|
321
337
|
actions: [
|
|
322
338
|
assign({
|
|
323
339
|
xyedges: ({ context, event }) => {
|
|
324
|
-
const hasDimmed = context.xyedges.some((edge) => edge.data.dimmed
|
|
340
|
+
const hasDimmed = context.xyedges.some((edge) => edge.data.dimmed !== false || edge.selected);
|
|
325
341
|
return context.xyedges.map((edge) => {
|
|
326
342
|
if (edge.id === event.edge.id) {
|
|
327
343
|
return Base.setData(edge, {
|
|
@@ -329,24 +345,26 @@ const relationshipsBrowserLogic = setup({
|
|
|
329
345
|
dimmed: false
|
|
330
346
|
});
|
|
331
347
|
}
|
|
332
|
-
return hasDimmed && !edge.
|
|
348
|
+
return hasDimmed && !edge.selected ? Base.setDimmed(edge, "immediate") : edge;
|
|
333
349
|
});
|
|
334
350
|
}
|
|
335
351
|
}),
|
|
336
352
|
cancel("undim.edges"),
|
|
337
353
|
cancel("dim.nonhovered.edges"),
|
|
338
|
-
raise({ type: "dim.nonhovered.edges" }, { id: "dim.nonhovered.edges", delay:
|
|
354
|
+
raise({ type: "dim.nonhovered.edges" }, { id: "dim.nonhovered.edges", delay: 200 })
|
|
339
355
|
]
|
|
340
356
|
},
|
|
341
357
|
"xyflow.edgeMouseLeave": {
|
|
342
358
|
actions: [
|
|
343
359
|
assign({
|
|
344
|
-
xyedges: ({ context, event }) =>
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
360
|
+
xyedges: ({ context, event }) => {
|
|
361
|
+
return context.xyedges.map((edge) => {
|
|
362
|
+
if (edge.id === event.edge.id) {
|
|
363
|
+
return Base.setHovered(edge, false);
|
|
364
|
+
}
|
|
365
|
+
return edge;
|
|
366
|
+
});
|
|
367
|
+
}
|
|
350
368
|
}),
|
|
351
369
|
cancel("dim.nonhovered.edges"),
|
|
352
370
|
raise({ type: "undim.edges" }, { id: "undim.edges", delay: 400 })
|
|
@@ -354,18 +372,14 @@ const relationshipsBrowserLogic = setup({
|
|
|
354
372
|
},
|
|
355
373
|
"dim.nonhovered.edges": {
|
|
356
374
|
actions: assign({
|
|
357
|
-
xyedges: ({ context }) => context.xyedges.map(
|
|
375
|
+
xyedges: ({ context }) => context.xyedges.map(
|
|
376
|
+
(edge) => edge.data.hovered ? edge : Base.setDimmed(edge, edge.data.dimmed === "immediate" ? "immediate" : true)
|
|
377
|
+
)
|
|
358
378
|
})
|
|
359
379
|
},
|
|
360
380
|
"undim.edges": {
|
|
361
381
|
actions: assign({
|
|
362
382
|
xyedges: ({ context }) => {
|
|
363
|
-
const hasSelected = context.xyedges.some((edge) => edge.selected === true);
|
|
364
|
-
if (hasSelected) {
|
|
365
|
-
return context.xyedges.map(
|
|
366
|
-
(edge) => Base.setDimmed(edge, edge.selected !== true ? edge.data.dimmed || "immediate" : false)
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
383
|
return context.xyedges.map(Base.setDimmed(false));
|
|
370
384
|
}
|
|
371
385
|
})
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { IconZoomScan, IconTransform, IconFileSymlink } from '@tabler/icons-react';
|
|
3
|
-
import {
|
|
3
|
+
import { useEnabledFeatures } from '../../../context/DiagramFeatures.js';
|
|
4
|
+
import { useCurrentViewId } from '../../../hooks/useCurrentViewId.js';
|
|
4
5
|
import { useDiagram } from '../../../hooks/useDiagram.js';
|
|
5
6
|
import { useRelationshipsBrowser, useRelationshipsBrowserState } from '../hooks.js';
|
|
6
7
|
import { ElementActionButtons } from '../../../base/primitives/element/ElementActionButtons.js';
|
|
7
8
|
|
|
8
9
|
const ElementActions = (props) => {
|
|
9
|
-
const { enableNavigateTo, enableVscode } =
|
|
10
|
+
const { enableNavigateTo, enableVscode } = useEnabledFeatures();
|
|
10
11
|
const diagram = useDiagram();
|
|
12
|
+
const currentViewId = useCurrentViewId();
|
|
11
13
|
const browser = useRelationshipsBrowser();
|
|
12
14
|
const subject = useRelationshipsBrowserState((s) => s.context.subject);
|
|
13
15
|
const buttons = [];
|
|
14
16
|
const { navigateTo, fqn } = props.data;
|
|
15
|
-
if (navigateTo && enableNavigateTo) {
|
|
17
|
+
if (navigateTo && enableNavigateTo && currentViewId !== navigateTo) {
|
|
16
18
|
buttons.push({
|
|
17
19
|
key: "navigate",
|
|
18
20
|
icon: /* @__PURE__ */ jsx(IconZoomScan, {}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { Position } from '@xyflow/system';
|
|
3
|
-
import { NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
3
|
+
import { Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
4
4
|
export declare const RelationshipEdge: NamedExoticComponent<{
|
|
5
5
|
id: string;
|
|
6
6
|
selected?: boolean;
|
|
@@ -33,6 +33,8 @@ export declare const RelationshipEdge: NamedExoticComponent<{
|
|
|
33
33
|
active?: boolean;
|
|
34
34
|
dimmed?: import("../../../base").Base.Dimmed;
|
|
35
35
|
} & {
|
|
36
|
+
sourceFqn: Fqn;
|
|
37
|
+
targetFqn: Fqn;
|
|
36
38
|
relations: NonEmptyArray<RelationId>;
|
|
37
39
|
color: Color | undefined;
|
|
38
40
|
label: string | null;
|
|
@@ -61,7 +61,7 @@ const RelationshipEdge = customEdge((props) => {
|
|
|
61
61
|
c: "black",
|
|
62
62
|
label: "This relationship is not included in the current view",
|
|
63
63
|
portalProps: {
|
|
64
|
-
target: `#${browser.rootElementId
|
|
64
|
+
target: `#${browser.rootElementId}`
|
|
65
65
|
},
|
|
66
66
|
openDelay: 800,
|
|
67
67
|
children: label
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fqn, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineType } from '@likec4/core';
|
|
2
|
-
import { LayoutRelationshipsViewResult } from './-useRelationshipsView';
|
|
3
2
|
import { RelationshipsBrowserActorRef, RelationshipsBrowserSnapshot, XYStoreApi, Events } from './actor';
|
|
3
|
+
import { LayoutRelationshipsViewResult } from './layout';
|
|
4
4
|
import { Context, ReactNode, CSSProperties } from 'react';
|
|
5
5
|
import { GeneralHelpers, ViewportHelperFunctions } from '@xyflow/react';
|
|
6
6
|
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
@@ -45,6 +45,8 @@ export declare function useRelationshipsBrowser(): {
|
|
|
45
45
|
focusable?: boolean;
|
|
46
46
|
type: "relationship";
|
|
47
47
|
data: {
|
|
48
|
+
sourceFqn: Fqn;
|
|
49
|
+
targetFqn: Fqn;
|
|
48
50
|
relations: NonEmptyArray<RelationId>;
|
|
49
51
|
color: Color | undefined;
|
|
50
52
|
label: string | null;
|
|
@@ -18,7 +18,7 @@ function useRelationshipsBrowser() {
|
|
|
18
18
|
return useMemo(() => ({
|
|
19
19
|
actor,
|
|
20
20
|
get rootElementId() {
|
|
21
|
-
return `relationships-browser-${actor.sessionId}`;
|
|
21
|
+
return `relationships-browser-${actor.sessionId.replaceAll(":", "_")}`;
|
|
22
22
|
},
|
|
23
23
|
getState: () => actor.getSnapshot().context,
|
|
24
24
|
send: actor.send,
|
|
@@ -128,6 +128,8 @@ function layoutRelationshipsView(data, scope) {
|
|
|
128
128
|
toArray(data.incoming),
|
|
129
129
|
map((r) => ({
|
|
130
130
|
id: r.source.id,
|
|
131
|
+
sourceFqn: r.source.id,
|
|
132
|
+
targetFqn: r.target.id,
|
|
131
133
|
source: incomers.byId(r.source.id).graph,
|
|
132
134
|
target: subjects.byId(r.target.id).graph,
|
|
133
135
|
relation: r
|
|
@@ -137,6 +139,8 @@ function layoutRelationshipsView(data, scope) {
|
|
|
137
139
|
toArray(data.outgoing),
|
|
138
140
|
map((r) => ({
|
|
139
141
|
id: r.target.id,
|
|
142
|
+
sourceFqn: r.source.id,
|
|
143
|
+
targetFqn: r.target.id,
|
|
140
144
|
source: subjects.byId(r.source.id).graph,
|
|
141
145
|
target: outgoers.byId(r.target.id).graph,
|
|
142
146
|
relation: r
|
|
@@ -160,6 +164,8 @@ function layoutRelationshipsView(data, scope) {
|
|
|
160
164
|
}, name);
|
|
161
165
|
edges.push({
|
|
162
166
|
name,
|
|
167
|
+
sourceFqn: grouped[0].sourceFqn,
|
|
168
|
+
targetFqn: grouped[0].targetFqn,
|
|
163
169
|
source: source.id,
|
|
164
170
|
sourceHandle: source.id + "_out" + (g.node(source.id).outPorts.length - 1),
|
|
165
171
|
target: target.id,
|
|
@@ -357,7 +363,7 @@ function layoutRelationshipsView(data, scope) {
|
|
|
357
363
|
const children = (g.children(id) ?? []).filter((c) => !c.endsWith(PortSuffix));
|
|
358
364
|
minX = Math.min(minX, position.x);
|
|
359
365
|
minY = Math.min(minY, position.y);
|
|
360
|
-
const navigateTo = element.
|
|
366
|
+
const navigateTo = scope ? ifind(element.scopedViews(), (v) => v.id !== scope.id)?.id ?? null : null;
|
|
361
367
|
const inheritFromNode = scope?.findNodeWithElement(element.id);
|
|
362
368
|
const scopedAncestor = scope && !inheritFromNode ? ifind(element.ancestors(), (a) => !!scope.findNodeWithElement(a.id))?.id : null;
|
|
363
369
|
const inheritFromNodeOrAncestor = inheritFromNode ?? (scopedAncestor && scope?.findNodeWithElement(scopedAncestor));
|
|
@@ -416,15 +422,26 @@ function layoutRelationshipsView(data, scope) {
|
|
|
416
422
|
if (!ename) {
|
|
417
423
|
return acc;
|
|
418
424
|
}
|
|
419
|
-
const {
|
|
425
|
+
const {
|
|
426
|
+
name,
|
|
427
|
+
source,
|
|
428
|
+
sourceFqn,
|
|
429
|
+
target,
|
|
430
|
+
targetFqn,
|
|
431
|
+
relations,
|
|
432
|
+
sourceHandle,
|
|
433
|
+
targetHandle
|
|
434
|
+
} = find(edges, (e2) => e2.name === ename);
|
|
420
435
|
const onlyRelation = only(relations);
|
|
421
436
|
const label = onlyRelation?.title ?? "untitled";
|
|
422
437
|
const isMultiple = relations.length > 1;
|
|
423
438
|
const navigateTo = only(unique(relations.flatMap((r) => r.navigateTo?.id ? r.navigateTo.id : [])));
|
|
424
439
|
acc.push({
|
|
425
440
|
id: name,
|
|
441
|
+
sourceFqn,
|
|
426
442
|
source,
|
|
427
443
|
sourceHandle,
|
|
444
|
+
targetFqn,
|
|
428
445
|
target,
|
|
429
446
|
targetHandle,
|
|
430
447
|
label: isMultiple ? `${relations.length} relationships` : label,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LayoutRelationshipsViewResult } from './-useRelationshipsView';
|
|
2
1
|
import { RelationshipsBrowserTypes } from './_types';
|
|
2
|
+
import { LayoutRelationshipsViewResult } from './layout';
|
|
3
3
|
export declare function viewToNodesEdge(view: Pick<LayoutRelationshipsViewResult, 'nodes' | 'edges'>): {
|
|
4
4
|
xynodes: RelationshipsBrowserTypes.Node[];
|
|
5
5
|
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
@@ -2,7 +2,7 @@ import { Queue, ElementKind, nonNullable, DiagramNode, invariant } from '@likec4
|
|
|
2
2
|
import '@react-hookz/web';
|
|
3
3
|
import { hasAtLeast } from 'remeda';
|
|
4
4
|
import { ZIndexes } from '../../base/const.js';
|
|
5
|
-
import { LayoutRelationshipsViewResult } from '
|
|
5
|
+
import { LayoutRelationshipsViewResult } from './layout.js';
|
|
6
6
|
|
|
7
7
|
function viewToNodesEdge(view) {
|
|
8
8
|
const xynodes = [], xyedges = [], nodeLookup = /* @__PURE__ */ new Map();
|
|
@@ -142,6 +142,8 @@ function viewToNodesEdge(view) {
|
|
|
142
142
|
// hidden: !visiblePredicate(edge),
|
|
143
143
|
deletable: false,
|
|
144
144
|
data: {
|
|
145
|
+
sourceFqn: edge.sourceFqn,
|
|
146
|
+
targetFqn: edge.targetFqn,
|
|
145
147
|
relations: edge.relations,
|
|
146
148
|
color: edge.color ?? "gray",
|
|
147
149
|
label: edge.label,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pipe } from 'remeda';
|
|
2
2
|
import { invariant } from '../../errors/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { isDescendantOf, sortParentsFirst } from '../../utils/fqn.js';
|
|
4
4
|
import { treeFromElements } from './utils.js';
|
|
5
5
|
import { toSet, toArray } from '../../utils/iterable/to.js';
|
|
6
6
|
import { ifilter } from '../../utils/iterable/filter.js';
|