@principal-ai/principal-view-react 0.8.0 → 0.8.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/dist/components/ConfigurationSelector.d.ts +1 -1
- package/dist/components/ConfigurationSelector.d.ts.map +1 -1
- package/dist/components/EdgeInfoPanel.d.ts +1 -1
- package/dist/components/EdgeInfoPanel.d.ts.map +1 -1
- package/dist/components/EdgeInfoPanel.js +77 -86
- package/dist/components/EdgeInfoPanel.js.map +1 -1
- package/dist/components/GraphRenderer.d.ts +1 -1
- package/dist/components/GraphRenderer.d.ts.map +1 -1
- package/dist/components/GraphRenderer.js +1 -1
- package/dist/components/GraphRenderer.js.map +1 -1
- package/dist/components/NodeInfoPanel.d.ts +1 -1
- package/dist/components/NodeInfoPanel.d.ts.map +1 -1
- package/dist/components/NodeInfoPanel.js +88 -67
- package/dist/components/NodeInfoPanel.js.map +1 -1
- package/dist/components/NodeTooltip.d.ts +1 -0
- package/dist/components/NodeTooltip.d.ts.map +1 -1
- package/dist/components/NodeTooltip.js +12 -2
- package/dist/components/NodeTooltip.js.map +1 -1
- package/dist/components/SelectionSidebar.d.ts +1 -1
- package/dist/components/SelectionSidebar.d.ts.map +1 -1
- package/dist/edges/CustomEdge.d.ts +1 -1
- package/dist/edges/CustomEdge.d.ts.map +1 -1
- package/dist/edges/GenericEdge.d.ts +1 -1
- package/dist/edges/GenericEdge.d.ts.map +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/nodes/CustomNode.d.ts +1 -1
- package/dist/nodes/CustomNode.d.ts.map +1 -1
- package/dist/nodes/CustomNode.js +5 -4
- package/dist/nodes/CustomNode.js.map +1 -1
- package/dist/nodes/GenericNode.d.ts +1 -1
- package/dist/nodes/GenericNode.d.ts.map +1 -1
- package/dist/utils/animationMapping.d.ts +1 -1
- package/dist/utils/animationMapping.d.ts.map +1 -1
- package/dist/utils/graphConverter.d.ts +1 -1
- package/dist/utils/graphConverter.d.ts.map +1 -1
- package/dist/utils/orientationUtils.d.ts +1 -1
- package/dist/utils/orientationUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/ConfigurationSelector.tsx +1 -1
- package/src/components/EdgeInfoPanel.tsx +161 -167
- package/src/components/GraphRenderer.test.tsx +1 -1
- package/src/components/GraphRenderer.tsx +2 -2
- package/src/components/NodeInfoPanel.tsx +178 -139
- package/src/components/NodeTooltip.tsx +28 -0
- package/src/components/PendingChanges.test.tsx +1 -1
- package/src/components/SelectionSidebar.tsx +1 -1
- package/src/edges/CustomEdge.tsx +1 -1
- package/src/edges/GenericEdge.tsx +1 -1
- package/src/hooks/usePathBasedEvents.ts +1 -1
- package/src/index.ts +1 -1
- package/src/nodes/CustomNode.tsx +6 -2
- package/src/nodes/GenericNode.tsx +1 -1
- package/src/stories/AnimationWorkshop.stories.tsx +1 -1
- package/src/stories/CanvasEdgeTypes.stories.tsx +1 -1
- package/src/stories/CanvasNodeTypes.stories.tsx +1 -1
- package/src/stories/ColorPriority.stories.tsx +1 -1
- package/src/stories/EventDrivenAnimations.stories.tsx +1 -1
- package/src/stories/GraphOrientation.stories.tsx +2 -2
- package/src/stories/GraphRenderer.stories.tsx +253 -1
- package/src/stories/MultiConfig.stories.tsx +1 -1
- package/src/stories/MultiDirectionalConnections.stories.tsx +1 -1
- package/src/stories/NodeFieldsAudit.stories.tsx +1 -1
- package/src/stories/NodeShapes.stories.tsx +1 -1
- package/src/stories/OtelComponents.stories.tsx +1 -1
- package/src/stories/TraceViewer.stories.tsx +1 -1
- package/src/stories/data/graph-converter-test-execution.json +256 -38
- package/src/stories/data/graph-converter-validated-execution.json +6 -6
- package/src/utils/animationMapping.ts +1 -1
- package/src/utils/graphConverter.ts +1 -1
- package/src/utils/orientationUtils.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import type { NodeState, NodeTypeDefinition, JsonValue } from '@principal-ai/principal-view-core
|
|
2
|
+
import type { NodeState, NodeTypeDefinition, JsonValue } from '@principal-ai/principal-view-core';
|
|
3
3
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
4
4
|
import { resolveIcon } from '../utils/iconResolver';
|
|
5
5
|
|
|
@@ -164,17 +164,17 @@ export const NodeInfoPanel: React.FC<NodeInfoPanelProps> = ({
|
|
|
164
164
|
<div
|
|
165
165
|
style={{
|
|
166
166
|
position: 'absolute',
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
bottom: 0,
|
|
168
|
+
left: 0,
|
|
169
|
+
right: 0,
|
|
169
170
|
backgroundColor: theme.colors.background,
|
|
170
171
|
color: theme.colors.text,
|
|
171
|
-
|
|
172
|
-
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
|
173
|
-
padding: '16px',
|
|
174
|
-
minWidth: '250px',
|
|
175
|
-
maxWidth: '350px',
|
|
172
|
+
borderTop: `2px solid ${nodeColor}`,
|
|
173
|
+
boxShadow: '0 -4px 12px rgba(0,0,0,0.15)',
|
|
174
|
+
padding: '16px 24px',
|
|
176
175
|
zIndex: 1000,
|
|
177
|
-
|
|
176
|
+
maxHeight: '40%',
|
|
177
|
+
overflowY: 'auto',
|
|
178
178
|
}}
|
|
179
179
|
>
|
|
180
180
|
{/* Header - shows node name */}
|
|
@@ -182,14 +182,17 @@ export const NodeInfoPanel: React.FC<NodeInfoPanelProps> = ({
|
|
|
182
182
|
style={{
|
|
183
183
|
display: 'flex',
|
|
184
184
|
justifyContent: 'space-between',
|
|
185
|
-
alignItems: '
|
|
186
|
-
marginBottom: '
|
|
187
|
-
paddingBottom: '8px',
|
|
188
|
-
borderBottom: `2px solid ${nodeColor}`,
|
|
185
|
+
alignItems: 'flex-start',
|
|
186
|
+
marginBottom: '16px',
|
|
189
187
|
}}
|
|
190
188
|
>
|
|
191
|
-
<div style={{
|
|
192
|
-
{
|
|
189
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px', flex: 1 }}>
|
|
190
|
+
<div style={{ fontWeight: theme.fontWeights.bold, fontSize: theme.fontSizes[2], fontFamily: theme.fonts.body, color: nodeColor }}>
|
|
191
|
+
{node.name || node.id}
|
|
192
|
+
</div>
|
|
193
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textMuted }}>
|
|
194
|
+
{node.type}
|
|
195
|
+
</div>
|
|
193
196
|
</div>
|
|
194
197
|
<button
|
|
195
198
|
onClick={onClose}
|
|
@@ -200,144 +203,180 @@ export const NodeInfoPanel: React.FC<NodeInfoPanelProps> = ({
|
|
|
200
203
|
fontSize: theme.fontSizes[3],
|
|
201
204
|
fontFamily: theme.fonts.body,
|
|
202
205
|
color: theme.colors.textSecondary,
|
|
203
|
-
padding: '
|
|
204
|
-
width: '
|
|
205
|
-
height: '
|
|
206
|
+
padding: '4px',
|
|
207
|
+
width: '28px',
|
|
208
|
+
height: '28px',
|
|
206
209
|
display: 'flex',
|
|
207
210
|
alignItems: 'center',
|
|
208
211
|
justifyContent: 'center',
|
|
212
|
+
borderRadius: '4px',
|
|
213
|
+
transition: 'background-color 0.15s',
|
|
214
|
+
}}
|
|
215
|
+
onMouseEnter={(e) => {
|
|
216
|
+
e.currentTarget.style.backgroundColor = theme.colors.muted;
|
|
217
|
+
}}
|
|
218
|
+
onMouseLeave={(e) => {
|
|
219
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
209
220
|
}}
|
|
210
221
|
>
|
|
211
222
|
×
|
|
212
223
|
</button>
|
|
213
224
|
</div>
|
|
214
225
|
|
|
215
|
-
{/*
|
|
216
|
-
{
|
|
217
|
-
<div style={{ marginBottom: '12px' }}>
|
|
218
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
219
|
-
Description
|
|
220
|
-
</div>
|
|
221
|
-
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body }}>{String(node.data.description)}</div>
|
|
222
|
-
</div>
|
|
223
|
-
)}
|
|
226
|
+
{/* Content - use horizontal layout for better space usage */}
|
|
227
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '24px' }}>
|
|
224
228
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
borderRadius: '4px',
|
|
268
|
-
color: theme.colors.textSecondary,
|
|
269
|
-
}}
|
|
270
|
-
>
|
|
271
|
-
{source}
|
|
272
|
-
</span>
|
|
273
|
-
)
|
|
229
|
+
{/* Left column - Description and basic info */}
|
|
230
|
+
<div>
|
|
231
|
+
{/* Description - first field under header */}
|
|
232
|
+
{node.data?.description && (
|
|
233
|
+
<div style={{ marginBottom: '12px' }}>
|
|
234
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
235
|
+
Description
|
|
236
|
+
</div>
|
|
237
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body }}>{String(node.data.description)}</div>
|
|
238
|
+
</div>
|
|
239
|
+
)}
|
|
240
|
+
|
|
241
|
+
{/* OTEL Info */}
|
|
242
|
+
{otelInfo && (
|
|
243
|
+
<div style={{ marginBottom: '12px' }}>
|
|
244
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
245
|
+
OpenTelemetry
|
|
246
|
+
</div>
|
|
247
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '6px', alignItems: 'center' }}>
|
|
248
|
+
{/* Kind badge */}
|
|
249
|
+
{otelInfo.kind && (
|
|
250
|
+
<span
|
|
251
|
+
style={{
|
|
252
|
+
fontSize: theme.fontSizes[0],
|
|
253
|
+
fontWeight: theme.fontWeights.semibold,
|
|
254
|
+
fontFamily: theme.fonts.body,
|
|
255
|
+
padding: '3px 8px',
|
|
256
|
+
borderRadius: '4px',
|
|
257
|
+
textTransform: 'uppercase',
|
|
258
|
+
color: 'white',
|
|
259
|
+
backgroundColor:
|
|
260
|
+
otelInfo.kind === 'type'
|
|
261
|
+
? '#4A90E2'
|
|
262
|
+
: otelInfo.kind === 'service'
|
|
263
|
+
? '#7ED321'
|
|
264
|
+
: otelInfo.kind === 'instance'
|
|
265
|
+
? '#9B59B6'
|
|
266
|
+
: '#888',
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
{otelInfo.kind}
|
|
270
|
+
</span>
|
|
274
271
|
)}
|
|
275
|
-
|
|
272
|
+
{/* Category */}
|
|
273
|
+
{otelInfo.category && (
|
|
274
|
+
<span
|
|
275
|
+
style={{
|
|
276
|
+
fontSize: theme.fontSizes[0],
|
|
277
|
+
fontFamily: theme.fonts.body,
|
|
278
|
+
color: theme.colors.textSecondary,
|
|
279
|
+
}}
|
|
280
|
+
>
|
|
281
|
+
{otelInfo.category}
|
|
282
|
+
</span>
|
|
283
|
+
)}
|
|
284
|
+
{/* NEW badge */}
|
|
285
|
+
{otelInfo.isNew && (
|
|
286
|
+
<span
|
|
287
|
+
style={{
|
|
288
|
+
fontSize: theme.fontSizes[0],
|
|
289
|
+
fontWeight: theme.fontWeights.semibold,
|
|
290
|
+
fontFamily: theme.fonts.body,
|
|
291
|
+
padding: '2px 6px',
|
|
292
|
+
borderRadius: '3px',
|
|
293
|
+
backgroundColor: '#F5A623',
|
|
294
|
+
color: 'white',
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
NEW
|
|
298
|
+
</span>
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
)}
|
|
276
303
|
</div>
|
|
277
|
-
)}
|
|
278
304
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
305
|
+
{/* Right column - Sources and other metadata */}
|
|
306
|
+
<div>
|
|
307
|
+
{/* Sources */}
|
|
308
|
+
{sources.length > 0 && (
|
|
309
|
+
<div style={{ marginBottom: '12px' }}>
|
|
310
|
+
<div style={{ fontSize: theme.fontSizes[0], fontFamily: theme.fonts.body, color: theme.colors.textSecondary, marginBottom: '4px' }}>
|
|
311
|
+
Sources
|
|
312
|
+
</div>
|
|
313
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
|
|
314
|
+
{sources.map((source, index) =>
|
|
315
|
+
onSourceClick ? (
|
|
316
|
+
<button
|
|
317
|
+
key={index}
|
|
318
|
+
onClick={() => {
|
|
319
|
+
console.log('Source clicked:', source, 'from node:', node.id);
|
|
320
|
+
onSourceClick(node.id, source);
|
|
321
|
+
}}
|
|
322
|
+
style={{
|
|
323
|
+
fontSize: theme.fontSizes[0],
|
|
324
|
+
fontFamily: 'monospace',
|
|
325
|
+
padding: '6px 10px',
|
|
326
|
+
backgroundColor: theme.colors.muted,
|
|
327
|
+
borderRadius: '4px',
|
|
328
|
+
color: theme.colors.primary,
|
|
329
|
+
border: `1px solid ${theme.colors.border}`,
|
|
330
|
+
cursor: 'pointer',
|
|
331
|
+
transition: 'all 0.15s',
|
|
332
|
+
textAlign: 'left',
|
|
333
|
+
width: '100%',
|
|
334
|
+
textDecoration: 'underline',
|
|
335
|
+
textDecorationStyle: 'dotted',
|
|
336
|
+
textDecorationColor: theme.colors.primary,
|
|
337
|
+
}}
|
|
338
|
+
onMouseEnter={(e) => {
|
|
339
|
+
e.currentTarget.style.backgroundColor = theme.colors.primary;
|
|
340
|
+
e.currentTarget.style.color = theme.colors.background;
|
|
341
|
+
e.currentTarget.style.borderColor = theme.colors.primary;
|
|
342
|
+
e.currentTarget.style.textDecoration = 'underline';
|
|
343
|
+
e.currentTarget.style.textDecorationColor = theme.colors.background;
|
|
344
|
+
}}
|
|
345
|
+
onMouseLeave={(e) => {
|
|
346
|
+
e.currentTarget.style.backgroundColor = theme.colors.muted;
|
|
347
|
+
e.currentTarget.style.color = theme.colors.primary;
|
|
348
|
+
e.currentTarget.style.borderColor = theme.colors.border;
|
|
349
|
+
e.currentTarget.style.textDecoration = 'underline';
|
|
350
|
+
e.currentTarget.style.textDecorationStyle = 'dotted';
|
|
351
|
+
e.currentTarget.style.textDecorationColor = theme.colors.primary;
|
|
352
|
+
}}
|
|
353
|
+
>
|
|
354
|
+
{source}
|
|
355
|
+
</button>
|
|
356
|
+
) : (
|
|
357
|
+
<span
|
|
358
|
+
key={index}
|
|
359
|
+
style={{
|
|
360
|
+
fontSize: theme.fontSizes[0],
|
|
361
|
+
fontFamily: 'monospace',
|
|
362
|
+
padding: '6px 10px',
|
|
363
|
+
backgroundColor: theme.colors.muted,
|
|
364
|
+
borderRadius: '4px',
|
|
365
|
+
color: theme.colors.textSecondary,
|
|
366
|
+
display: 'block',
|
|
367
|
+
border: `1px solid ${theme.colors.border}`,
|
|
368
|
+
}}
|
|
369
|
+
>
|
|
370
|
+
{source}
|
|
371
|
+
</span>
|
|
372
|
+
)
|
|
373
|
+
)}
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
)}
|
|
339
377
|
</div>
|
|
340
|
-
|
|
378
|
+
|
|
379
|
+
</div>
|
|
341
380
|
|
|
342
381
|
{/* Expand/Collapse button for additional details */}
|
|
343
382
|
<button
|
|
@@ -11,6 +11,7 @@ export interface OtelInfo {
|
|
|
11
11
|
export interface NodeTooltipProps {
|
|
12
12
|
description?: string;
|
|
13
13
|
otel?: OtelInfo;
|
|
14
|
+
sources?: string[];
|
|
14
15
|
visible: boolean;
|
|
15
16
|
/** Reference to the node element for positioning */
|
|
16
17
|
nodeRef?: React.RefObject<HTMLDivElement>;
|
|
@@ -23,6 +24,7 @@ export interface NodeTooltipProps {
|
|
|
23
24
|
export const NodeTooltip: React.FC<NodeTooltipProps> = ({
|
|
24
25
|
description,
|
|
25
26
|
otel,
|
|
27
|
+
sources,
|
|
26
28
|
visible,
|
|
27
29
|
nodeRef,
|
|
28
30
|
}) => {
|
|
@@ -161,6 +163,32 @@ export const NodeTooltip: React.FC<NodeTooltipProps> = ({
|
|
|
161
163
|
<div style={{ lineHeight: '1.4', color: description ? 'rgba(255,255,255,0.9)' : 'rgba(255,255,255,0.5)' }}>
|
|
162
164
|
{description || 'No description'}
|
|
163
165
|
</div>
|
|
166
|
+
|
|
167
|
+
{/* Sources */}
|
|
168
|
+
{sources && sources.length > 0 && (
|
|
169
|
+
<div style={{ marginTop: '8px', borderTop: '1px solid rgba(255,255,255,0.2)', paddingTop: '6px' }}>
|
|
170
|
+
<div style={{
|
|
171
|
+
fontSize: theme.fontSizes[0],
|
|
172
|
+
fontWeight: theme.fontWeights.semibold,
|
|
173
|
+
color: 'rgba(255,255,255,0.7)',
|
|
174
|
+
marginBottom: '4px'
|
|
175
|
+
}}>
|
|
176
|
+
Sources:
|
|
177
|
+
</div>
|
|
178
|
+
<div style={{ fontSize: theme.fontSizes[0], color: 'rgba(255,255,255,0.8)' }}>
|
|
179
|
+
{sources.map((source, index) => (
|
|
180
|
+
<div key={index} style={{
|
|
181
|
+
fontFamily: 'monospace',
|
|
182
|
+
fontSize: theme.fontSizes[0],
|
|
183
|
+
marginTop: index > 0 ? '2px' : 0,
|
|
184
|
+
wordBreak: 'break-all'
|
|
185
|
+
}}>
|
|
186
|
+
{source}
|
|
187
|
+
</div>
|
|
188
|
+
))}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
164
192
|
</div>
|
|
165
193
|
);
|
|
166
194
|
|
|
@@ -2,7 +2,7 @@ import { describe, expect, test, mock } from 'bun:test';
|
|
|
2
2
|
import React, { createRef } from 'react';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
4
|
import { GraphRenderer, type GraphRendererHandle } from './GraphRenderer';
|
|
5
|
-
import type { ExtendedCanvas } from '@principal-ai/principal-view-core
|
|
5
|
+
import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
6
6
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
7
7
|
import { Window } from 'happy-dom';
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import type { NodeState, NodeTypeDefinition } from '@principal-ai/principal-view-core
|
|
2
|
+
import type { NodeState, NodeTypeDefinition } from '@principal-ai/principal-view-core';
|
|
3
3
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
4
4
|
import { resolveIcon } from '../utils/iconResolver';
|
|
5
5
|
|
package/src/edges/CustomEdge.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { BaseEdge, EdgeLabelRenderer, getBezierPath } from '@xyflow/react';
|
|
3
3
|
import type { EdgeProps } from '@xyflow/react';
|
|
4
|
-
import type { EdgeTypeDefinition } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { EdgeTypeDefinition } from '@principal-ai/principal-view-core';
|
|
5
5
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
|
|
7
7
|
export interface CustomEdgeData extends Record<string, unknown> {
|
package/src/index.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type {
|
|
|
26
26
|
ComponentLibrary,
|
|
27
27
|
LibraryNodeComponent,
|
|
28
28
|
LibraryEdgeComponent,
|
|
29
|
-
} from '@principal-ai/principal-view-core
|
|
29
|
+
} from '@principal-ai/principal-view-core';
|
|
30
30
|
|
|
31
31
|
// Export components
|
|
32
32
|
export { GraphRenderer } from './components/GraphRenderer';
|
package/src/nodes/CustomNode.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef } from 'react';
|
|
2
2
|
import { Handle, Position, NodeResizer } from '@xyflow/react';
|
|
3
3
|
import type { NodeProps } from '@xyflow/react';
|
|
4
|
-
import type { NodeTypeDefinition } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { NodeTypeDefinition } from '@principal-ai/principal-view-core';
|
|
5
5
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
import { resolveIcon } from '../utils/iconResolver';
|
|
7
7
|
import { NodeTooltip } from '../components/NodeTooltip';
|
|
@@ -81,9 +81,10 @@ export const CustomNode: React.FC<NodeProps<any>> = ({ data, selected, dragging
|
|
|
81
81
|
// Only show tooltip when hovering, not dragging, and shift key is pressed
|
|
82
82
|
const showTooltip = isHovered && !dragging && shiftKeyPressed;
|
|
83
83
|
|
|
84
|
-
// Extract OTEL info and
|
|
84
|
+
// Extract OTEL info, description, and sources for tooltip
|
|
85
85
|
const otelInfo = nodeData?.otel as OtelInfo | undefined;
|
|
86
86
|
const description = nodeData?.description as string | undefined;
|
|
87
|
+
const sources = nodeData?.sources as string[] | undefined;
|
|
87
88
|
|
|
88
89
|
// OTEL kind badge colors
|
|
89
90
|
const getOtelBadgeColor = (kind: string) => {
|
|
@@ -516,6 +517,7 @@ export const CustomNode: React.FC<NodeProps<any>> = ({ data, selected, dragging
|
|
|
516
517
|
<NodeTooltip
|
|
517
518
|
description={description}
|
|
518
519
|
otel={otelInfo}
|
|
520
|
+
sources={sources}
|
|
519
521
|
visible={showTooltip}
|
|
520
522
|
nodeRef={nodeRef}
|
|
521
523
|
/>
|
|
@@ -571,6 +573,7 @@ export const CustomNode: React.FC<NodeProps<any>> = ({ data, selected, dragging
|
|
|
571
573
|
<NodeTooltip
|
|
572
574
|
description={description}
|
|
573
575
|
otel={otelInfo}
|
|
576
|
+
sources={sources}
|
|
574
577
|
visible={showTooltip}
|
|
575
578
|
nodeRef={nodeRef}
|
|
576
579
|
/>
|
|
@@ -651,6 +654,7 @@ export const CustomNode: React.FC<NodeProps<any>> = ({ data, selected, dragging
|
|
|
651
654
|
<NodeTooltip
|
|
652
655
|
description={description}
|
|
653
656
|
otel={otelInfo}
|
|
657
|
+
sources={sources}
|
|
654
658
|
visible={showTooltip}
|
|
655
659
|
nodeRef={nodeRef}
|
|
656
660
|
/>
|
|
@@ -5,7 +5,7 @@ import { CustomNode } from '../nodes/CustomNode';
|
|
|
5
5
|
import { CustomEdge } from '../edges/CustomEdge';
|
|
6
6
|
import type { CustomNodeData } from '../nodes/CustomNode';
|
|
7
7
|
import type { CustomEdgeData } from '../edges/CustomEdge';
|
|
8
|
-
import type { NodeTypeDefinition, EdgeTypeDefinition } from '@principal-ai/principal-view-core
|
|
8
|
+
import type { NodeTypeDefinition, EdgeTypeDefinition } from '@principal-ai/principal-view-core';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { GraphRenderer } from '../components/GraphRenderer';
|
|
4
|
-
import type { ExtendedCanvas } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
5
5
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { GraphRenderer } from '../components/GraphRenderer';
|
|
4
|
-
import type { ExtendedCanvas } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
5
5
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { GraphRenderer } from '../components/GraphRenderer';
|
|
4
|
-
import type { ExtendedCanvas, GraphEvent } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { ExtendedCanvas, GraphEvent } from '@principal-ai/principal-view-core';
|
|
5
5
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
|
|
7
7
|
// Helper component that sets initial node states via events
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { GraphRenderer } from '../components/GraphRenderer';
|
|
3
|
-
import type { GraphEvent, ExtendedCanvas } from '@principal-ai/principal-view-core
|
|
3
|
+
import type { GraphEvent, ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useState, useMemo } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { GraphRenderer } from '../components/GraphRenderer';
|
|
4
|
-
import type { ExtendedCanvas } from '@principal-ai/principal-view-core
|
|
4
|
+
import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
5
5
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
import { swapGraphOrientation } from '../utils/orientationUtils';
|
|
7
|
-
import { CanvasConverter } from '@principal-ai/principal-view-core
|
|
7
|
+
import { CanvasConverter } from '@principal-ai/principal-view-core';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
10
|
title: 'Features/Graph Orientation',
|