@likec4/diagram 1.24.0 → 1.24.1
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/dist/LikeC4Diagram.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +1 -0
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +6 -2
- package/dist/LikeC4Diagram.props.d.ts +6 -0
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +12 -3
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/primitives/compound/CompoundActionButton.css.js +2 -0
- package/dist/base/primitives/compound/CompoundDetailsButton.css.js +2 -0
- package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
- package/dist/base/primitives/compound/CompoundNodeContainer.js +35 -22
- package/dist/base/primitives/compound/CompoundTitle.css.js +3 -1
- package/dist/base/primitives/customNode.js +1 -1
- package/dist/base/primitives/edge/EdgeContainer.js +5 -4
- package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +2 -5
- package/dist/base/primitives/edge/EdgeLabel.js +5 -5
- package/dist/base/primitives/edge/edge.css.d.ts +1 -1
- package/dist/base/primitives/edge/edge.css.js +4 -5
- package/dist/base/primitives/element/ElementActionButtons.css.js +2 -0
- package/dist/base/primitives/element/ElementActionButtons.js +4 -3
- package/dist/base/primitives/element/ElementDetailsButton.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.css.js +2 -0
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -1
- package/dist/base/primitives/element/ElementShape.css.js +4 -2
- package/dist/base/primitives/element/ElementShape.js +2 -3
- package/dist/base/primitives/element/ElementTitle.css.js +2 -0
- package/dist/base/primitives/element/styles.css.js +2 -0
- package/dist/components/SearchControl.css.js +2 -0
- package/dist/context/FramerMotionConfig.d.ts +9 -1
- package/dist/context/FramerMotionConfig.js +5 -2
- package/dist/context/RootContainer.js +13 -1
- package/dist/diagram.css +1 -1
- package/dist/globals.css.d.ts +2 -0
- package/dist/hooks/safeContext.js +1 -0
- package/dist/hooks/useDiagram.d.ts +554 -864
- package/dist/hooks/useDiagram.js +1 -0
- package/dist/hooks/useIsReducedGraphics.d.ts +4 -0
- package/dist/hooks/useIsReducedGraphics.js +8 -0
- package/dist/hooks/useXYFlow.js +1 -1
- package/dist/likec4diagram/DiagramUI.d.ts +2 -1
- package/dist/likec4diagram/DiagramUI.js +5 -3
- package/dist/likec4diagram/custom/nodes/nodeTypes.js +2 -2
- package/dist/likec4diagram/ui/controls/styles.css.js +2 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.js +2 -0
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +3 -4
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +2 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +12 -8
- package/dist/overlays/element-details/actor.d.ts +9084 -2569
- package/dist/overlays/overlay/Overlay.js +6 -3
- package/dist/overlays/relationship-details/RelationshipDetails.js +31 -17
- package/dist/overlays/relationship-details/actor.d.ts +228 -3
- package/dist/overlays/relationship-details/actor.js +86 -14
- package/dist/overlays/relationship-details/hooks.d.ts +3 -0
- package/dist/overlays/relationship-details/hooks.js +6 -2
- package/dist/overlays/relationships-browser/-useRelationshipsView.js +12 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +12 -3
- package/dist/overlays/relationships-browser/actor.d.ts +271 -54
- package/dist/overlays/relationships-browser/actor.js +86 -23
- package/dist/state/DiagramActorProvider.js +12 -2
- package/dist/state/diagram-machine.d.ts +563 -867
- package/dist/state/diagram-machine.js +82 -81
- package/dist/state/persistence.d.ts +5 -0
- package/dist/state/persistence.js +23 -0
- package/package.json +9 -9
- package/src/LikeC4Diagram.css.ts +13 -5
- package/src/LikeC4Diagram.props.ts +7 -0
- package/src/LikeC4Diagram.tsx +33 -24
- package/src/base/BaseXYFlow.tsx +14 -9
- package/src/base/const.ts +1 -1
- package/src/base/primitives/compound/CompoundActionButton.css.ts +6 -0
- package/src/base/primitives/compound/CompoundDetailsButton.css.ts +4 -0
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +41 -59
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +42 -22
- package/src/base/primitives/compound/CompoundTitle.css.ts +14 -13
- package/src/base/primitives/customNode.ts +3 -2
- package/src/base/primitives/edge/EdgeContainer.tsx +4 -3
- package/src/base/primitives/edge/EdgeLabel.css.ts +17 -11
- package/src/base/primitives/edge/EdgeLabel.tsx +4 -4
- package/src/base/primitives/edge/edge.css.ts +47 -27
- package/src/base/primitives/element/ElementActionButtons.css.ts +4 -0
- package/src/base/primitives/element/ElementActionButtons.tsx +4 -2
- package/src/base/primitives/element/ElementDetailsButton.css.ts +6 -8
- package/src/base/primitives/element/ElementNodeContainer.css.ts +18 -21
- package/src/base/primitives/element/ElementNodeContainer.tsx +3 -1
- package/src/base/primitives/element/ElementShape.css.ts +10 -6
- package/src/base/primitives/element/ElementShape.tsx +2 -2
- package/src/components/SearchControl.css.ts +11 -4
- package/src/context/FramerMotionConfig.tsx +13 -2
- package/src/context/RootContainer.tsx +9 -2
- package/src/globals.css.ts +3 -0
- package/src/hooks/safeContext.tsx +2 -1
- package/src/hooks/useDiagram.ts +1 -0
- package/src/hooks/useIsReducedGraphics.ts +5 -0
- package/src/hooks/useXYFlow.ts +1 -1
- package/src/likec4diagram/DiagramUI.tsx +5 -3
- package/src/likec4diagram/custom/nodes/nodeTypes.tsx +2 -2
- package/src/likec4diagram/ui/controls/styles.css.ts +11 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.ts +10 -3
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +6 -3
- package/src/likec4diagram/ui/search/LikeC4Search.css.ts +1 -0
- package/src/overlays/element-details/ElementDetailsCard.tsx +238 -231
- package/src/overlays/overlay/Overlay.css.ts +1 -9
- package/src/overlays/overlay/Overlay.tsx +6 -3
- package/src/overlays/relationship-details/RelationshipDetails.tsx +83 -66
- package/src/overlays/relationship-details/actor.ts +106 -13
- package/src/overlays/relationship-details/hooks.ts +6 -2
- package/src/overlays/relationships-browser/-useRelationshipsView.ts +10 -0
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +16 -8
- package/src/overlays/relationships-browser/actor.ts +92 -22
- package/src/state/DiagramActorProvider.tsx +13 -2
- package/src/state/diagram-machine.ts +80 -79
- package/src/state/persistence.ts +22 -0
|
@@ -18,8 +18,8 @@ function RelationshipsBrowser({ actorRef }) {
|
|
|
18
18
|
const initialRef = useRef(null);
|
|
19
19
|
if (initialRef.current == null) {
|
|
20
20
|
initialRef.current = {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
initialNodes: [],
|
|
22
|
+
initialEdges: []
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
return /* @__PURE__ */ jsx(RelationshipsBrowserActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: false, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(RelationshipsBrowserXYFlow, {}) }) }) }) });
|
|
@@ -49,6 +49,7 @@ const RelationshipsBrowserXYFlow = memo(() => {
|
|
|
49
49
|
className: clsx(isActive ? "initialized" : "not-initialized"),
|
|
50
50
|
nodeTypes,
|
|
51
51
|
edgeTypes,
|
|
52
|
+
fitView: false,
|
|
52
53
|
fitViewPadding: ViewPadding,
|
|
53
54
|
onNodeClick: useCallbackRef((e, node) => {
|
|
54
55
|
e.stopPropagation();
|
|
@@ -75,8 +76,16 @@ const RelationshipsBrowserXYFlow = memo(() => {
|
|
|
75
76
|
onEdgesChange: useCallbackRef((changes) => {
|
|
76
77
|
browser.send({ type: "xyflow.applyEdgeChanges", changes });
|
|
77
78
|
}),
|
|
79
|
+
onEdgeMouseEnter: useCallbackRef((_event, edge) => {
|
|
80
|
+
browser.send({ type: "xyflow.edgeMouseEnter", edge });
|
|
81
|
+
}),
|
|
82
|
+
onEdgeMouseLeave: useCallbackRef((_event, edge) => {
|
|
83
|
+
browser.send({ type: "xyflow.edgeMouseLeave", edge });
|
|
84
|
+
}),
|
|
85
|
+
onSelectionChange: useCallbackRef((params) => {
|
|
86
|
+
browser.send({ type: "xyflow.selectionChange", ...params });
|
|
87
|
+
}),
|
|
78
88
|
nodesDraggable: false,
|
|
79
|
-
fitView: false,
|
|
80
89
|
pannable: true,
|
|
81
90
|
zoomable: true,
|
|
82
91
|
children: /* @__PURE__ */ jsx(RelationshipsBrowserInner, {})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BBox, DiagramView, Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
2
2
|
import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
3
|
-
import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, PromiseActorLogic, EventObject, StateMachine, Values, NonReducibleUnknown, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction,
|
|
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
5
|
import { LayoutRelationshipsViewResult } from './-useRelationshipsView';
|
|
6
6
|
import { RelationshipsBrowserTypes } from './_types';
|
|
@@ -52,6 +52,14 @@ export type Events = {
|
|
|
52
52
|
} | {
|
|
53
53
|
type: 'xyflow.edgeMouseLeave';
|
|
54
54
|
edge: RelationshipsBrowserTypes.Edge;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'xyflow.selectionChange';
|
|
57
|
+
nodes: RelationshipsBrowserTypes.Node[];
|
|
58
|
+
edges: RelationshipsBrowserTypes.Edge[];
|
|
59
|
+
} | {
|
|
60
|
+
type: 'dim.nonhovered.edges';
|
|
61
|
+
} | {
|
|
62
|
+
type: 'undim.edges';
|
|
55
63
|
} | {
|
|
56
64
|
type: 'xyflow.updateNodeInternals';
|
|
57
65
|
} | {
|
|
@@ -411,7 +419,7 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<Input & {
|
|
|
411
419
|
readonly isReady: {
|
|
412
420
|
readonly always: readonly [{
|
|
413
421
|
readonly guard: "isReady";
|
|
414
|
-
readonly actions: ActionFunction<Readonly<Input & {
|
|
422
|
+
readonly actions: readonly [ ActionFunction<Readonly<Input & {
|
|
415
423
|
closeable: boolean;
|
|
416
424
|
enableNavigationMenu: boolean;
|
|
417
425
|
xyflow: XYFLowInstance | null;
|
|
@@ -420,7 +428,16 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<Input & {
|
|
|
420
428
|
navigateFromNode: string | null;
|
|
421
429
|
xynodes: RelationshipsBrowserTypes.Node[];
|
|
422
430
|
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
423
|
-
}>, Events, Events, undefined, never, never, never, never, never
|
|
431
|
+
}>, Events, Events, undefined, never, never, never, never, never>, ActionFunction<Readonly<Input & {
|
|
432
|
+
closeable: boolean;
|
|
433
|
+
enableNavigationMenu: boolean;
|
|
434
|
+
xyflow: XYFLowInstance | null;
|
|
435
|
+
xystore: XYStoreApi | null;
|
|
436
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
437
|
+
navigateFromNode: string | null;
|
|
438
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
439
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
440
|
+
}>, Events, Events, undefined, never, never, never, never, never>];
|
|
424
441
|
readonly target: "active";
|
|
425
442
|
}, {
|
|
426
443
|
readonly target: "initializing";
|
|
@@ -430,7 +447,232 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<Input & {
|
|
|
430
447
|
readonly initial: "idle";
|
|
431
448
|
readonly tags: readonly ["active"];
|
|
432
449
|
readonly states: {
|
|
433
|
-
readonly idle: {
|
|
450
|
+
readonly idle: {
|
|
451
|
+
readonly on: {
|
|
452
|
+
readonly 'xyflow.edgeMouseEnter': {
|
|
453
|
+
readonly actions: readonly [ ActionFunction<Readonly<Input & {
|
|
454
|
+
closeable: boolean;
|
|
455
|
+
enableNavigationMenu: boolean;
|
|
456
|
+
xyflow: XYFLowInstance | null;
|
|
457
|
+
xystore: XYStoreApi | null;
|
|
458
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
459
|
+
navigateFromNode: string | null;
|
|
460
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
461
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
462
|
+
}>, {
|
|
463
|
+
type: "xyflow.edgeMouseEnter";
|
|
464
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
465
|
+
}, Events, undefined, {
|
|
466
|
+
src: "layouter";
|
|
467
|
+
logic: PromiseActorLogic<{
|
|
468
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
469
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
470
|
+
}, {
|
|
471
|
+
subjectId: Fqn;
|
|
472
|
+
navigateFromNode: string | null;
|
|
473
|
+
xyflow: XYFLowInstance;
|
|
474
|
+
xystore: XYStoreApi;
|
|
475
|
+
update: LayoutRelationshipsViewResult;
|
|
476
|
+
}, EventObject>;
|
|
477
|
+
id: "layouter";
|
|
478
|
+
}, never, never, never, never>, CancelAction<Readonly<Input & {
|
|
479
|
+
closeable: boolean;
|
|
480
|
+
enableNavigationMenu: boolean;
|
|
481
|
+
xyflow: XYFLowInstance | null;
|
|
482
|
+
xystore: XYStoreApi | null;
|
|
483
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
484
|
+
navigateFromNode: string | null;
|
|
485
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
486
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
487
|
+
}>, {
|
|
488
|
+
type: "xyflow.edgeMouseEnter";
|
|
489
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
490
|
+
}, undefined, Events>, CancelAction<Readonly<Input & {
|
|
491
|
+
closeable: boolean;
|
|
492
|
+
enableNavigationMenu: boolean;
|
|
493
|
+
xyflow: XYFLowInstance | null;
|
|
494
|
+
xystore: XYStoreApi | null;
|
|
495
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
496
|
+
navigateFromNode: string | null;
|
|
497
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
498
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
499
|
+
}>, {
|
|
500
|
+
type: "xyflow.edgeMouseEnter";
|
|
501
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
502
|
+
}, undefined, Events>, ActionFunction<Readonly<Input & {
|
|
503
|
+
closeable: boolean;
|
|
504
|
+
enableNavigationMenu: boolean;
|
|
505
|
+
xyflow: XYFLowInstance | null;
|
|
506
|
+
xystore: XYStoreApi | null;
|
|
507
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
508
|
+
navigateFromNode: string | null;
|
|
509
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
510
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
511
|
+
}>, {
|
|
512
|
+
type: "xyflow.edgeMouseEnter";
|
|
513
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
514
|
+
}, Events, undefined, never, never, never, never, never>];
|
|
515
|
+
};
|
|
516
|
+
readonly 'xyflow.edgeMouseLeave': {
|
|
517
|
+
readonly actions: readonly [ ActionFunction<Readonly<Input & {
|
|
518
|
+
closeable: boolean;
|
|
519
|
+
enableNavigationMenu: boolean;
|
|
520
|
+
xyflow: XYFLowInstance | null;
|
|
521
|
+
xystore: XYStoreApi | null;
|
|
522
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
523
|
+
navigateFromNode: string | null;
|
|
524
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
525
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
526
|
+
}>, {
|
|
527
|
+
type: "xyflow.edgeMouseLeave";
|
|
528
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
529
|
+
}, Events, undefined, {
|
|
530
|
+
src: "layouter";
|
|
531
|
+
logic: PromiseActorLogic<{
|
|
532
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
533
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
534
|
+
}, {
|
|
535
|
+
subjectId: Fqn;
|
|
536
|
+
navigateFromNode: string | null;
|
|
537
|
+
xyflow: XYFLowInstance;
|
|
538
|
+
xystore: XYStoreApi;
|
|
539
|
+
update: LayoutRelationshipsViewResult;
|
|
540
|
+
}, EventObject>;
|
|
541
|
+
id: "layouter";
|
|
542
|
+
}, never, never, never, never>, CancelAction<Readonly<Input & {
|
|
543
|
+
closeable: boolean;
|
|
544
|
+
enableNavigationMenu: boolean;
|
|
545
|
+
xyflow: XYFLowInstance | null;
|
|
546
|
+
xystore: XYStoreApi | null;
|
|
547
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
548
|
+
navigateFromNode: string | null;
|
|
549
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
550
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
551
|
+
}>, {
|
|
552
|
+
type: "xyflow.edgeMouseLeave";
|
|
553
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
554
|
+
}, undefined, Events>, ActionFunction<Readonly<Input & {
|
|
555
|
+
closeable: boolean;
|
|
556
|
+
enableNavigationMenu: boolean;
|
|
557
|
+
xyflow: XYFLowInstance | null;
|
|
558
|
+
xystore: XYStoreApi | null;
|
|
559
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
560
|
+
navigateFromNode: string | null;
|
|
561
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
562
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
563
|
+
}>, {
|
|
564
|
+
type: "xyflow.edgeMouseLeave";
|
|
565
|
+
edge: RelationshipsBrowserTypes.Edge;
|
|
566
|
+
}, Events, undefined, never, never, never, never, never>];
|
|
567
|
+
};
|
|
568
|
+
readonly 'dim.nonhovered.edges': {
|
|
569
|
+
readonly actions: ActionFunction<Readonly<Input & {
|
|
570
|
+
closeable: boolean;
|
|
571
|
+
enableNavigationMenu: boolean;
|
|
572
|
+
xyflow: XYFLowInstance | null;
|
|
573
|
+
xystore: XYStoreApi | null;
|
|
574
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
575
|
+
navigateFromNode: string | null;
|
|
576
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
577
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
578
|
+
}>, {
|
|
579
|
+
type: "dim.nonhovered.edges";
|
|
580
|
+
}, Events, undefined, {
|
|
581
|
+
src: "layouter";
|
|
582
|
+
logic: PromiseActorLogic<{
|
|
583
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
584
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
585
|
+
}, {
|
|
586
|
+
subjectId: Fqn;
|
|
587
|
+
navigateFromNode: string | null;
|
|
588
|
+
xyflow: XYFLowInstance;
|
|
589
|
+
xystore: XYStoreApi;
|
|
590
|
+
update: LayoutRelationshipsViewResult;
|
|
591
|
+
}, EventObject>;
|
|
592
|
+
id: "layouter";
|
|
593
|
+
}, never, never, never, never>;
|
|
594
|
+
};
|
|
595
|
+
readonly 'undim.edges': {
|
|
596
|
+
readonly actions: ActionFunction<Readonly<Input & {
|
|
597
|
+
closeable: boolean;
|
|
598
|
+
enableNavigationMenu: boolean;
|
|
599
|
+
xyflow: XYFLowInstance | null;
|
|
600
|
+
xystore: XYStoreApi | null;
|
|
601
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
602
|
+
navigateFromNode: string | null;
|
|
603
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
604
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
605
|
+
}>, {
|
|
606
|
+
type: "undim.edges";
|
|
607
|
+
}, Events, undefined, {
|
|
608
|
+
src: "layouter";
|
|
609
|
+
logic: PromiseActorLogic<{
|
|
610
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
611
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
612
|
+
}, {
|
|
613
|
+
subjectId: Fqn;
|
|
614
|
+
navigateFromNode: string | null;
|
|
615
|
+
xyflow: XYFLowInstance;
|
|
616
|
+
xystore: XYStoreApi;
|
|
617
|
+
update: LayoutRelationshipsViewResult;
|
|
618
|
+
}, EventObject>;
|
|
619
|
+
id: "layouter";
|
|
620
|
+
}, never, never, never, never>;
|
|
621
|
+
};
|
|
622
|
+
readonly 'xyflow.selectionChange': {
|
|
623
|
+
readonly actions: ActionFunction<Readonly<Input & {
|
|
624
|
+
closeable: boolean;
|
|
625
|
+
enableNavigationMenu: boolean;
|
|
626
|
+
xyflow: XYFLowInstance | null;
|
|
627
|
+
xystore: XYStoreApi | null;
|
|
628
|
+
layouted: LayoutRelationshipsViewResult | null;
|
|
629
|
+
navigateFromNode: string | null;
|
|
630
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
631
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
632
|
+
}>, {
|
|
633
|
+
type: "xyflow.selectionChange";
|
|
634
|
+
nodes: RelationshipsBrowserTypes.Node[];
|
|
635
|
+
edges: RelationshipsBrowserTypes.Edge[];
|
|
636
|
+
}, Events, undefined, {
|
|
637
|
+
src: "layouter";
|
|
638
|
+
logic: PromiseActorLogic<{
|
|
639
|
+
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
640
|
+
xynodes: RelationshipsBrowserTypes.Node[];
|
|
641
|
+
}, {
|
|
642
|
+
subjectId: Fqn;
|
|
643
|
+
navigateFromNode: string | null;
|
|
644
|
+
xyflow: XYFLowInstance;
|
|
645
|
+
xystore: XYStoreApi;
|
|
646
|
+
update: LayoutRelationshipsViewResult;
|
|
647
|
+
}, EventObject>;
|
|
648
|
+
id: "layouter";
|
|
649
|
+
}, Values<{
|
|
650
|
+
"xyflow.init": {
|
|
651
|
+
type: "xyflow.init";
|
|
652
|
+
params: NonReducibleUnknown;
|
|
653
|
+
};
|
|
654
|
+
"update.view": {
|
|
655
|
+
type: "update.view";
|
|
656
|
+
params: NonReducibleUnknown;
|
|
657
|
+
};
|
|
658
|
+
"xyflow:updateNodeInternals": {
|
|
659
|
+
type: "xyflow:updateNodeInternals";
|
|
660
|
+
params: unknown;
|
|
661
|
+
};
|
|
662
|
+
"xyflow:fitDiagram": {
|
|
663
|
+
type: "xyflow:fitDiagram";
|
|
664
|
+
params: {
|
|
665
|
+
duration?: number;
|
|
666
|
+
bounds?: BBox;
|
|
667
|
+
} | undefined;
|
|
668
|
+
};
|
|
669
|
+
}>, {
|
|
670
|
+
type: "isReady";
|
|
671
|
+
params: unknown;
|
|
672
|
+
}, never, EventObject>;
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
};
|
|
434
676
|
readonly layouting: {
|
|
435
677
|
readonly invoke: {
|
|
436
678
|
readonly id: "layouter";
|
|
@@ -805,7 +1047,7 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<Input & {
|
|
|
805
1047
|
};
|
|
806
1048
|
readonly onDone: {
|
|
807
1049
|
readonly target: "idle";
|
|
808
|
-
readonly actions:
|
|
1050
|
+
readonly actions: ActionFunction<Readonly<Input & {
|
|
809
1051
|
closeable: boolean;
|
|
810
1052
|
enableNavigationMenu: boolean;
|
|
811
1053
|
xyflow: XYFLowInstance | null;
|
|
@@ -830,55 +1072,30 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<Input & {
|
|
|
830
1072
|
update: LayoutRelationshipsViewResult;
|
|
831
1073
|
}, EventObject>;
|
|
832
1074
|
id: "layouter";
|
|
833
|
-
},
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
}, string>, Events, undefined, never, never, never, never, never>, ActionFunction<Readonly<Input & {
|
|
858
|
-
closeable: boolean;
|
|
859
|
-
enableNavigationMenu: boolean;
|
|
860
|
-
xyflow: XYFLowInstance | null;
|
|
861
|
-
xystore: XYStoreApi | null;
|
|
862
|
-
layouted: LayoutRelationshipsViewResult | null;
|
|
863
|
-
navigateFromNode: string | null;
|
|
864
|
-
xynodes: RelationshipsBrowserTypes.Node[];
|
|
865
|
-
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
866
|
-
}>, DoneActorEvent<{
|
|
867
|
-
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
868
|
-
xynodes: RelationshipsBrowserTypes.Node[];
|
|
869
|
-
}, string>, Events, undefined, never, never, never, never, never>, ActionFunction<Readonly<Input & {
|
|
870
|
-
closeable: boolean;
|
|
871
|
-
enableNavigationMenu: boolean;
|
|
872
|
-
xyflow: XYFLowInstance | null;
|
|
873
|
-
xystore: XYStoreApi | null;
|
|
874
|
-
layouted: LayoutRelationshipsViewResult | null;
|
|
875
|
-
navigateFromNode: string | null;
|
|
876
|
-
xynodes: RelationshipsBrowserTypes.Node[];
|
|
877
|
-
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
878
|
-
}>, DoneActorEvent<{
|
|
879
|
-
xyedges: RelationshipsBrowserTypes.Edge[];
|
|
880
|
-
xynodes: RelationshipsBrowserTypes.Node[];
|
|
881
|
-
}, string>, Events, undefined, never, never, never, never, never>];
|
|
1075
|
+
}, Values<{
|
|
1076
|
+
"xyflow.init": {
|
|
1077
|
+
type: "xyflow.init";
|
|
1078
|
+
params: NonReducibleUnknown;
|
|
1079
|
+
};
|
|
1080
|
+
"update.view": {
|
|
1081
|
+
type: "update.view";
|
|
1082
|
+
params: NonReducibleUnknown;
|
|
1083
|
+
};
|
|
1084
|
+
"xyflow:updateNodeInternals": {
|
|
1085
|
+
type: "xyflow:updateNodeInternals";
|
|
1086
|
+
params: unknown;
|
|
1087
|
+
};
|
|
1088
|
+
"xyflow:fitDiagram": {
|
|
1089
|
+
type: "xyflow:fitDiagram";
|
|
1090
|
+
params: {
|
|
1091
|
+
duration?: number;
|
|
1092
|
+
bounds?: BBox;
|
|
1093
|
+
} | undefined;
|
|
1094
|
+
};
|
|
1095
|
+
}>, {
|
|
1096
|
+
type: "isReady";
|
|
1097
|
+
params: unknown;
|
|
1098
|
+
}, never, EventObject>;
|
|
882
1099
|
};
|
|
883
1100
|
};
|
|
884
1101
|
readonly on: {
|
|
@@ -8,8 +8,8 @@ import { updateEdges } from "../../base/updateEdges.js";
|
|
|
8
8
|
import { updateNodes } from "../../base/updateNodes.js";
|
|
9
9
|
import { ViewPadding } from "./const.js";
|
|
10
10
|
import { viewToNodesEdge } from "./useViewToNodesEdges.js";
|
|
11
|
-
import { centerXYInternalNode } from "../../utils/xyflow.js";
|
|
12
11
|
import { Base } from "../../base/types.js";
|
|
12
|
+
import { centerXYInternalNode } from "../../utils/xyflow.js";
|
|
13
13
|
const findRootSubject = (nodes) => nodes.find(
|
|
14
14
|
(n) => n.data.column === "subjects" && isNullish(n.parentId)
|
|
15
15
|
);
|
|
@@ -159,7 +159,7 @@ const relationshipsBrowserLogic = setup({
|
|
|
159
159
|
updates.set(updateId, { id: updateId, nodeElement, force: true });
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
updateNodeInternals(updates, { triggerFitView: false });
|
|
163
163
|
},
|
|
164
164
|
"xyflow:fitDiagram": ({ context }, params) => {
|
|
165
165
|
var _a;
|
|
@@ -175,16 +175,14 @@ const relationshipsBrowserLogic = setup({
|
|
|
175
175
|
if (bounds) {
|
|
176
176
|
const { width, height } = xystore.getState();
|
|
177
177
|
const viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, ViewPadding);
|
|
178
|
-
|
|
178
|
+
xyflow.setViewport(viewport, duration > 0 ? { duration } : void 0);
|
|
179
179
|
} else {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
})
|
|
187
|
-
);
|
|
180
|
+
xyflow.fitView({
|
|
181
|
+
minZoom: MinZoom,
|
|
182
|
+
maxZoom,
|
|
183
|
+
padding: ViewPadding,
|
|
184
|
+
...duration > 0 && { duration }
|
|
185
|
+
});
|
|
188
186
|
}
|
|
189
187
|
}
|
|
190
188
|
}
|
|
@@ -236,7 +234,10 @@ const relationshipsBrowserLogic = setup({
|
|
|
236
234
|
"isReady": {
|
|
237
235
|
always: [{
|
|
238
236
|
guard: "isReady",
|
|
239
|
-
actions:
|
|
237
|
+
actions: [
|
|
238
|
+
raise({ type: "fitDiagram", duration: 0 }),
|
|
239
|
+
raise({ type: "xyflow.updateNodeInternals" }, { delay: 100 })
|
|
240
|
+
],
|
|
240
241
|
target: "active"
|
|
241
242
|
}, {
|
|
242
243
|
target: "initializing"
|
|
@@ -246,7 +247,70 @@ const relationshipsBrowserLogic = setup({
|
|
|
246
247
|
initial: "idle",
|
|
247
248
|
tags: ["active"],
|
|
248
249
|
states: {
|
|
249
|
-
"idle": {
|
|
250
|
+
"idle": {
|
|
251
|
+
on: {
|
|
252
|
+
"xyflow.edgeMouseEnter": {
|
|
253
|
+
actions: [
|
|
254
|
+
assign({
|
|
255
|
+
xyedges: ({ context, event }) => {
|
|
256
|
+
const hasDimmed = context.xyedges.some((edge) => edge.data.dimmed === true);
|
|
257
|
+
return context.xyedges.map((edge) => {
|
|
258
|
+
if (edge.id === event.edge.id) {
|
|
259
|
+
return Base.setData(edge, {
|
|
260
|
+
hovered: true,
|
|
261
|
+
dimmed: false
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return hasDimmed && !edge.data.dimmed && !edge.selected ? Base.setDimmed(edge, "immediate") : edge;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
cancel("undim.edges"),
|
|
269
|
+
cancel("dim.nonhovered.edges"),
|
|
270
|
+
raise({ type: "dim.nonhovered.edges" }, { id: "dim.nonhovered.edges", delay: 100 })
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
"xyflow.edgeMouseLeave": {
|
|
274
|
+
actions: [
|
|
275
|
+
assign({
|
|
276
|
+
xyedges: ({ context, event }) => context.xyedges.map((edge) => {
|
|
277
|
+
if (edge.id === event.edge.id) {
|
|
278
|
+
return Base.setHovered(edge, false);
|
|
279
|
+
}
|
|
280
|
+
return edge;
|
|
281
|
+
})
|
|
282
|
+
}),
|
|
283
|
+
cancel("dim.nonhovered.edges"),
|
|
284
|
+
raise({ type: "undim.edges" }, { id: "undim.edges", delay: 400 })
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
"dim.nonhovered.edges": {
|
|
288
|
+
actions: assign({
|
|
289
|
+
xyedges: ({ context }) => context.xyedges.map((edge) => Base.setDimmed(edge, edge.data.hovered !== true))
|
|
290
|
+
})
|
|
291
|
+
},
|
|
292
|
+
"undim.edges": {
|
|
293
|
+
actions: assign({
|
|
294
|
+
xyedges: ({ context }) => {
|
|
295
|
+
const hasSelected = context.xyedges.some((edge) => edge.selected === true);
|
|
296
|
+
if (hasSelected) {
|
|
297
|
+
return context.xyedges.map(
|
|
298
|
+
(edge) => Base.setDimmed(edge, edge.selected !== true ? edge.data.dimmed || "immediate" : false)
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
return context.xyedges.map(Base.setDimmed(false));
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
},
|
|
305
|
+
"xyflow.selectionChange": {
|
|
306
|
+
actions: enqueueActions(({ event, context, enqueue }) => {
|
|
307
|
+
if (event.edges.length === 0 && context.xyedges.some((e) => e.data.dimmed) && !context.xyedges.some((e) => e.data.hovered)) {
|
|
308
|
+
enqueue.raise({ type: "undim.edges" });
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
250
314
|
"layouting": {
|
|
251
315
|
invoke: {
|
|
252
316
|
id: "layouter",
|
|
@@ -262,17 +326,16 @@ const relationshipsBrowserLogic = setup({
|
|
|
262
326
|
},
|
|
263
327
|
onDone: {
|
|
264
328
|
target: "idle",
|
|
265
|
-
actions:
|
|
266
|
-
assign({
|
|
267
|
-
xynodes:
|
|
268
|
-
xyedges:
|
|
329
|
+
actions: enqueueActions(({ enqueue, event }) => {
|
|
330
|
+
enqueue.assign({
|
|
331
|
+
xynodes: event.output.xynodes,
|
|
332
|
+
xyedges: event.output.xyedges,
|
|
269
333
|
navigateFromNode: null
|
|
270
|
-
}),
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
]
|
|
334
|
+
}), enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 50 });
|
|
335
|
+
for (let i = 0; i <= 10; i++) {
|
|
336
|
+
enqueue.raise({ type: "xyflow.updateNodeInternals" }, { delay: 100 + i * 50 });
|
|
337
|
+
}
|
|
338
|
+
})
|
|
276
339
|
}
|
|
277
340
|
},
|
|
278
341
|
on: {
|
|
@@ -3,7 +3,7 @@ import { useCallbackRef } from "@mantine/hooks";
|
|
|
3
3
|
import { useActorRef, useSelector } from "@xstate/react";
|
|
4
4
|
import { useStoreApi } from "@xyflow/react";
|
|
5
5
|
import { shallowEqual } from "fast-equals";
|
|
6
|
-
import { useEffect } from "react";
|
|
6
|
+
import { useEffect, useRef } from "react";
|
|
7
7
|
import { useDiagramEventHandlersRef } from "../context/DiagramEventHandlers.js";
|
|
8
8
|
import { useEnabledFeatures, DiagramFeatures } from "../context/DiagramFeatures.js";
|
|
9
9
|
import { DiagramActorSafeContext } from "../hooks/safeContext.js";
|
|
@@ -63,8 +63,18 @@ const SyncStore = ({ input: { view, xyedges, xynodes, ...inputs }, actorRef }) =
|
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
actorRef.send({ type: "update.features", features });
|
|
65
65
|
}, [actorRef, features]);
|
|
66
|
+
const frameReq = useRef(null);
|
|
66
67
|
useUpdateEffect(() => {
|
|
67
|
-
|
|
68
|
+
frameReq.current = requestAnimationFrame(() => {
|
|
69
|
+
frameReq.current = null;
|
|
70
|
+
actorRef.send({ type: "update.view", view, xyedges, xynodes });
|
|
71
|
+
});
|
|
72
|
+
return () => {
|
|
73
|
+
if (frameReq.current != null) {
|
|
74
|
+
cancelAnimationFrame(frameReq.current);
|
|
75
|
+
}
|
|
76
|
+
frameReq.current = null;
|
|
77
|
+
};
|
|
68
78
|
}, [actorRef, view, xyedges, xynodes]);
|
|
69
79
|
return null;
|
|
70
80
|
};
|