@principal-ai/principal-view-react 0.13.7 → 0.13.9
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 +1 -15
- package/dist/components/GraphRenderer.d.ts.map +1 -1
- package/dist/components/GraphRenderer.js +115 -269
- package/dist/components/GraphRenderer.js.map +1 -1
- package/dist/components/NodeInfoPanel.d.ts.map +1 -1
- package/dist/components/NodeInfoPanel.js.map +1 -1
- package/dist/edges/CustomEdge.d.ts +2 -2
- package/dist/edges/CustomEdge.d.ts.map +1 -1
- package/dist/edges/CustomEdge.js +5 -4
- package/dist/edges/CustomEdge.js.map +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts.map +1 -1
- package/dist/hooks/usePathBasedEvents.js +2 -1
- package/dist/hooks/usePathBasedEvents.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/nodes/CustomNode.d.ts +2 -2
- package/dist/nodes/CustomNode.d.ts.map +1 -1
- package/dist/nodes/CustomNode.js +41 -10
- package/dist/nodes/CustomNode.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GraphRenderer.tsx +132 -352
- package/src/edges/CustomEdge.tsx +8 -7
- package/src/hooks/usePathBasedEvents.ts +2 -1
- package/src/index.ts +0 -6
- package/src/nodes/CustomNode.tsx +50 -13
- package/src/stories/ColorPriority.stories.tsx +2 -0
- package/src/stories/EventDrivenAnimations.stories.tsx +332 -326
- package/src/stories/GraphRenderer.stories.tsx +2 -2
- package/src/stories/NodeDefinitionComparison.stories.tsx +1 -1
- package/src/stories/NodeDimensionsTesting.stories.tsx +2 -2
- package/src/stories/OtelComponents.stories.tsx +0 -47
- package/src/stories/data/graph-converter-test-execution.json +244 -26
- package/src/stories/data/graph-converter-validated-execution.json +6 -6
- package/src/components/EdgeInfoPanel.tsx +0 -247
- package/src/components/NodeInfoPanel.tsx +0 -724
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { EdgeState, EdgeTypeDefinition } from '@principal-ai/principal-view-core';
|
|
3
|
-
import { useTheme } from '@principal-ade/industry-theme';
|
|
4
|
-
|
|
5
|
-
export interface EdgeInfoPanelProps {
|
|
6
|
-
edge: EdgeState;
|
|
7
|
-
typeDefinition: EdgeTypeDefinition;
|
|
8
|
-
sourceNodeId: string;
|
|
9
|
-
targetNodeId: string;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
/** Optional callback to delete the edge. If not provided, delete button is hidden. */
|
|
12
|
-
onDelete?: (edgeId: string) => void;
|
|
13
|
-
/** Optional callback to update edge sides. If not provided, side selectors are disabled. */
|
|
14
|
-
onUpdateSides?: (edgeId: string, fromSide: string, toSide: string) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Panel that displays information about a selected edge
|
|
19
|
-
*/
|
|
20
|
-
const SIDE_OPTIONS = ['top', 'right', 'bottom', 'left'] as const;
|
|
21
|
-
|
|
22
|
-
export const EdgeInfoPanel: React.FC<EdgeInfoPanelProps> = ({
|
|
23
|
-
edge,
|
|
24
|
-
typeDefinition,
|
|
25
|
-
sourceNodeId,
|
|
26
|
-
targetNodeId,
|
|
27
|
-
onClose,
|
|
28
|
-
onDelete,
|
|
29
|
-
onUpdateSides,
|
|
30
|
-
}) => {
|
|
31
|
-
const { theme } = useTheme();
|
|
32
|
-
const edgeColor = typeDefinition.color || theme.colors.primary;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div
|
|
36
|
-
style={{
|
|
37
|
-
position: 'absolute',
|
|
38
|
-
bottom: 0,
|
|
39
|
-
left: 0,
|
|
40
|
-
right: 0,
|
|
41
|
-
backgroundColor: theme.colors.background,
|
|
42
|
-
color: theme.colors.text,
|
|
43
|
-
borderTop: `2px solid ${edgeColor}`,
|
|
44
|
-
boxShadow: '0 -4px 12px rgba(0,0,0,0.15)',
|
|
45
|
-
padding: '16px 24px',
|
|
46
|
-
zIndex: 1000,
|
|
47
|
-
maxHeight: '40%',
|
|
48
|
-
overflowY: 'auto',
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
{/* Header */}
|
|
52
|
-
<div
|
|
53
|
-
style={{
|
|
54
|
-
display: 'flex',
|
|
55
|
-
justifyContent: 'space-between',
|
|
56
|
-
alignItems: 'flex-start',
|
|
57
|
-
marginBottom: '16px',
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: '12px', flex: 1 }}>
|
|
61
|
-
<div style={{ fontWeight: theme.fontWeights.bold, fontSize: theme.fontSizes[2], fontFamily: theme.fonts.body, color: edgeColor }}>
|
|
62
|
-
Edge Information
|
|
63
|
-
</div>
|
|
64
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted }}>
|
|
65
|
-
{edge.type}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
<button
|
|
69
|
-
onClick={onClose}
|
|
70
|
-
style={{
|
|
71
|
-
border: 'none',
|
|
72
|
-
background: 'none',
|
|
73
|
-
cursor: 'pointer',
|
|
74
|
-
fontSize: theme.fontSizes[3],
|
|
75
|
-
fontFamily: theme.fonts.body,
|
|
76
|
-
color: theme.colors.textSecondary,
|
|
77
|
-
padding: '4px',
|
|
78
|
-
width: '28px',
|
|
79
|
-
height: '28px',
|
|
80
|
-
display: 'flex',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
justifyContent: 'center',
|
|
83
|
-
borderRadius: '4px',
|
|
84
|
-
transition: 'background-color 0.15s',
|
|
85
|
-
}}
|
|
86
|
-
onMouseEnter={(e) => {
|
|
87
|
-
e.currentTarget.style.backgroundColor = theme.colors.muted;
|
|
88
|
-
}}
|
|
89
|
-
onMouseLeave={(e) => {
|
|
90
|
-
e.currentTarget.style.backgroundColor = 'transparent';
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
×
|
|
94
|
-
</button>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
{/* Content - use horizontal layout */}
|
|
98
|
-
<div style={{ display: 'flex', gap: '32px', alignItems: 'flex-start' }}>
|
|
99
|
-
|
|
100
|
-
{/* Left section - Connection Info */}
|
|
101
|
-
<div style={{ flex: 1 }}>
|
|
102
|
-
<div style={{ marginBottom: '12px' }}>
|
|
103
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
104
|
-
Connection
|
|
105
|
-
</div>
|
|
106
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body }}>
|
|
107
|
-
<span
|
|
108
|
-
style={{
|
|
109
|
-
fontFamily: theme.fonts.monospace,
|
|
110
|
-
backgroundColor: theme.colors.muted,
|
|
111
|
-
padding: '2px 6px',
|
|
112
|
-
borderRadius: '3px',
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
{sourceNodeId}
|
|
116
|
-
</span>
|
|
117
|
-
<span style={{ margin: '0 8px', color: theme.colors.textMuted }}>→</span>
|
|
118
|
-
<span
|
|
119
|
-
style={{
|
|
120
|
-
fontFamily: theme.fonts.monospace,
|
|
121
|
-
backgroundColor: theme.colors.muted,
|
|
122
|
-
padding: '2px 6px',
|
|
123
|
-
borderRadius: '3px',
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
{targetNodeId}
|
|
127
|
-
</span>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
{/* Metadata */}
|
|
132
|
-
<div
|
|
133
|
-
style={{
|
|
134
|
-
fontSize: theme.fontSizes[0],
|
|
135
|
-
fontFamily: theme.fonts.body,
|
|
136
|
-
color: theme.colors.textMuted,
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
ID: {edge.id}
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
{/* Center section - Connection Sides */}
|
|
144
|
-
<div style={{ flex: 1 }}>
|
|
145
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '8px' }}>
|
|
146
|
-
Connection Sides
|
|
147
|
-
</div>
|
|
148
|
-
<div style={{ display: 'flex', gap: '12px' }}>
|
|
149
|
-
<div style={{ flex: 1 }}>
|
|
150
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted, marginBottom: '4px' }}>
|
|
151
|
-
From Side
|
|
152
|
-
</div>
|
|
153
|
-
<select
|
|
154
|
-
value={(edge.data?.fromSide as string) || 'right'}
|
|
155
|
-
onChange={(e) => {
|
|
156
|
-
if (onUpdateSides) {
|
|
157
|
-
onUpdateSides(edge.id, e.target.value, (edge.data?.toSide as string) || 'left');
|
|
158
|
-
}
|
|
159
|
-
}}
|
|
160
|
-
disabled={!onUpdateSides}
|
|
161
|
-
style={{
|
|
162
|
-
width: '100%',
|
|
163
|
-
padding: '6px 8px',
|
|
164
|
-
fontSize: theme.fontSizes[0],
|
|
165
|
-
fontFamily: theme.fonts.body,
|
|
166
|
-
borderRadius: '4px',
|
|
167
|
-
border: `1px solid ${theme.colors.border}`,
|
|
168
|
-
backgroundColor: theme.colors.background,
|
|
169
|
-
color: theme.colors.text,
|
|
170
|
-
cursor: onUpdateSides ? 'pointer' : 'not-allowed',
|
|
171
|
-
opacity: onUpdateSides ? 1 : 0.6,
|
|
172
|
-
}}
|
|
173
|
-
>
|
|
174
|
-
{SIDE_OPTIONS.map((side) => (
|
|
175
|
-
<option key={side} value={side}>
|
|
176
|
-
{side}
|
|
177
|
-
</option>
|
|
178
|
-
))}
|
|
179
|
-
</select>
|
|
180
|
-
</div>
|
|
181
|
-
<div style={{ flex: 1 }}>
|
|
182
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted, marginBottom: '4px' }}>
|
|
183
|
-
To Side
|
|
184
|
-
</div>
|
|
185
|
-
<select
|
|
186
|
-
value={(edge.data?.toSide as string) || 'left'}
|
|
187
|
-
onChange={(e) => {
|
|
188
|
-
if (onUpdateSides) {
|
|
189
|
-
onUpdateSides(
|
|
190
|
-
edge.id,
|
|
191
|
-
(edge.data?.fromSide as string) || 'right',
|
|
192
|
-
e.target.value
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
}}
|
|
196
|
-
disabled={!onUpdateSides}
|
|
197
|
-
style={{
|
|
198
|
-
width: '100%',
|
|
199
|
-
padding: '6px 8px',
|
|
200
|
-
fontSize: theme.fontSizes[0],
|
|
201
|
-
fontFamily: theme.fonts.body,
|
|
202
|
-
borderRadius: '4px',
|
|
203
|
-
border: `1px solid ${theme.colors.border}`,
|
|
204
|
-
backgroundColor: theme.colors.background,
|
|
205
|
-
color: theme.colors.text,
|
|
206
|
-
cursor: onUpdateSides ? 'pointer' : 'not-allowed',
|
|
207
|
-
opacity: onUpdateSides ? 1 : 0.6,
|
|
208
|
-
}}
|
|
209
|
-
>
|
|
210
|
-
{SIDE_OPTIONS.map((side) => (
|
|
211
|
-
<option key={side} value={side}>
|
|
212
|
-
{side}
|
|
213
|
-
</option>
|
|
214
|
-
))}
|
|
215
|
-
</select>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
{/* Right section - Delete Button */}
|
|
221
|
-
{onDelete && (
|
|
222
|
-
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
|
|
223
|
-
<button
|
|
224
|
-
onClick={() => {
|
|
225
|
-
onDelete(edge.id);
|
|
226
|
-
onClose();
|
|
227
|
-
}}
|
|
228
|
-
style={{
|
|
229
|
-
padding: '8px 16px',
|
|
230
|
-
backgroundColor: theme.colors.error,
|
|
231
|
-
color: theme.colors.background,
|
|
232
|
-
border: 'none',
|
|
233
|
-
borderRadius: '4px',
|
|
234
|
-
cursor: 'pointer',
|
|
235
|
-
fontSize: theme.fontSizes[0],
|
|
236
|
-
fontFamily: theme.fonts.body,
|
|
237
|
-
fontWeight: theme.fontWeights.bold,
|
|
238
|
-
}}
|
|
239
|
-
>
|
|
240
|
-
Delete Edge
|
|
241
|
-
</button>
|
|
242
|
-
</div>
|
|
243
|
-
)}
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
);
|
|
247
|
-
};
|