@principal-ai/principal-view-react 0.13.22 → 0.13.24
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/components/GraphRenderer.d.ts +8 -0
- package/dist/components/GraphRenderer.d.ts.map +1 -1
- package/dist/components/GraphRenderer.js +249 -11
- package/dist/components/GraphRenderer.js.map +1 -1
- package/dist/hooks/useUndoRedo.d.ts +75 -0
- package/dist/hooks/useUndoRedo.d.ts.map +1 -0
- package/dist/hooks/useUndoRedo.js +70 -0
- package/dist/hooks/useUndoRedo.js.map +1 -0
- package/dist/nodes/CustomNode.d.ts.map +1 -1
- package/dist/nodes/CustomNode.js +7 -2
- package/dist/nodes/CustomNode.js.map +1 -1
- package/dist/utils/graphConverter.d.ts.map +1 -1
- package/dist/utils/graphConverter.js +2 -0
- package/dist/utils/graphConverter.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GraphRenderer.tsx +330 -9
- package/src/hooks/useUndoRedo.ts +138 -0
- package/src/nodes/CustomNode.tsx +16 -1
- package/src/stories/CanvasNodeTypes.stories.tsx +150 -0
- package/src/utils/graphConverter.ts +2 -0
|
@@ -740,6 +740,156 @@ This demonstrates a typical feature development context where you'd reference:
|
|
|
740
740
|
},
|
|
741
741
|
};
|
|
742
742
|
|
|
743
|
+
/**
|
|
744
|
+
* Canvas demonstrating edges rendering above group nodes
|
|
745
|
+
*/
|
|
746
|
+
const edgesOverGroupCanvas: ExtendedCanvas = {
|
|
747
|
+
nodes: [
|
|
748
|
+
// Group node (should render behind edges)
|
|
749
|
+
{
|
|
750
|
+
id: 'group-1',
|
|
751
|
+
type: 'group',
|
|
752
|
+
x: 150,
|
|
753
|
+
y: 80,
|
|
754
|
+
width: 300,
|
|
755
|
+
height: 200,
|
|
756
|
+
label: 'Processing Group',
|
|
757
|
+
color: 3, // yellow
|
|
758
|
+
pv: {
|
|
759
|
+
nodeType: 'group',
|
|
760
|
+
shape: 'rectangle',
|
|
761
|
+
},
|
|
762
|
+
},
|
|
763
|
+
// Node before group
|
|
764
|
+
{
|
|
765
|
+
id: 'start',
|
|
766
|
+
type: 'text',
|
|
767
|
+
x: 20,
|
|
768
|
+
y: 150,
|
|
769
|
+
width: 100,
|
|
770
|
+
height: 60,
|
|
771
|
+
text: 'Start',
|
|
772
|
+
color: 4,
|
|
773
|
+
pv: {
|
|
774
|
+
nodeType: 'process',
|
|
775
|
+
shape: 'rectangle',
|
|
776
|
+
icon: 'Play',
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
// Node inside group
|
|
780
|
+
{
|
|
781
|
+
id: 'process-1',
|
|
782
|
+
type: 'text',
|
|
783
|
+
x: 200,
|
|
784
|
+
y: 120,
|
|
785
|
+
width: 100,
|
|
786
|
+
height: 60,
|
|
787
|
+
text: 'Process A',
|
|
788
|
+
color: 5,
|
|
789
|
+
pv: {
|
|
790
|
+
nodeType: 'process',
|
|
791
|
+
shape: 'rectangle',
|
|
792
|
+
icon: 'Settings',
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
// Another node inside group
|
|
796
|
+
{
|
|
797
|
+
id: 'process-2',
|
|
798
|
+
type: 'text',
|
|
799
|
+
x: 200,
|
|
800
|
+
y: 200,
|
|
801
|
+
width: 100,
|
|
802
|
+
height: 60,
|
|
803
|
+
text: 'Process B',
|
|
804
|
+
color: 5,
|
|
805
|
+
pv: {
|
|
806
|
+
nodeType: 'process',
|
|
807
|
+
shape: 'rectangle',
|
|
808
|
+
icon: 'Cog',
|
|
809
|
+
},
|
|
810
|
+
},
|
|
811
|
+
// Node after group
|
|
812
|
+
{
|
|
813
|
+
id: 'end',
|
|
814
|
+
type: 'text',
|
|
815
|
+
x: 500,
|
|
816
|
+
y: 150,
|
|
817
|
+
width: 100,
|
|
818
|
+
height: 60,
|
|
819
|
+
text: 'End',
|
|
820
|
+
color: 4,
|
|
821
|
+
pv: {
|
|
822
|
+
nodeType: 'process',
|
|
823
|
+
shape: 'rectangle',
|
|
824
|
+
icon: 'CheckCircle',
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
],
|
|
828
|
+
edges: [
|
|
829
|
+
// Edge crossing over the group
|
|
830
|
+
{
|
|
831
|
+
id: 'start-to-process1',
|
|
832
|
+
fromNode: 'start',
|
|
833
|
+
toNode: 'process-1',
|
|
834
|
+
fromSide: 'right',
|
|
835
|
+
toSide: 'left',
|
|
836
|
+
pv: { edgeType: 'flow' },
|
|
837
|
+
},
|
|
838
|
+
// Edge within group
|
|
839
|
+
{
|
|
840
|
+
id: 'process1-to-process2',
|
|
841
|
+
fromNode: 'process-1',
|
|
842
|
+
toNode: 'process-2',
|
|
843
|
+
fromSide: 'bottom',
|
|
844
|
+
toSide: 'top',
|
|
845
|
+
pv: { edgeType: 'flow' },
|
|
846
|
+
},
|
|
847
|
+
// Edge crossing out of group
|
|
848
|
+
{
|
|
849
|
+
id: 'process2-to-end',
|
|
850
|
+
fromNode: 'process-2',
|
|
851
|
+
toNode: 'end',
|
|
852
|
+
fromSide: 'right',
|
|
853
|
+
toSide: 'left',
|
|
854
|
+
pv: { edgeType: 'flow' },
|
|
855
|
+
},
|
|
856
|
+
],
|
|
857
|
+
pv: {
|
|
858
|
+
version: '1.0.0',
|
|
859
|
+
name: 'Edges Over Groups',
|
|
860
|
+
description: 'Test that edges render above group nodes',
|
|
861
|
+
edgeTypes: {
|
|
862
|
+
flow: {
|
|
863
|
+
style: 'solid',
|
|
864
|
+
color: '#3b82f6',
|
|
865
|
+
directed: true,
|
|
866
|
+
},
|
|
867
|
+
},
|
|
868
|
+
},
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
export const EdgesOverGroups: Story = {
|
|
872
|
+
args: {
|
|
873
|
+
canvas: edgesOverGroupCanvas,
|
|
874
|
+
width: 650,
|
|
875
|
+
height: 350,
|
|
876
|
+
},
|
|
877
|
+
parameters: {
|
|
878
|
+
docs: {
|
|
879
|
+
description: {
|
|
880
|
+
story: `
|
|
881
|
+
**Edges Rendering Above Groups**
|
|
882
|
+
|
|
883
|
+
This story tests that edges properly render above group nodes.
|
|
884
|
+
- The yellow group container should be behind all edges
|
|
885
|
+
- Edges connecting to nodes inside the group should be visible
|
|
886
|
+
- Edges crossing over the group should not be hidden
|
|
887
|
+
`,
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
},
|
|
891
|
+
};
|
|
892
|
+
|
|
743
893
|
/**
|
|
744
894
|
* Interactive comparison template
|
|
745
895
|
*/
|
|
@@ -119,6 +119,8 @@ export function convertToXYFlowEdges(
|
|
|
119
119
|
sourceHandle,
|
|
120
120
|
targetHandle,
|
|
121
121
|
type: 'custom',
|
|
122
|
+
// Edges should render above groups (zIndex: 1) but below regular nodes (zIndex: 100)
|
|
123
|
+
zIndex: 50,
|
|
122
124
|
animated: typeDefinition?.style === 'animated',
|
|
123
125
|
markerEnd,
|
|
124
126
|
data: {
|