@principal-ai/subsystems-react 0.17.0 → 0.19.0

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.
Files changed (108) hide show
  1. package/README.md +11 -85
  2. package/dist/index.d.ts +7 -44
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +6 -32
  5. package/dist/index.js.map +1 -1
  6. package/dist/subsystem/SubsystemCarousel.d.ts +36 -0
  7. package/dist/subsystem/SubsystemCarousel.d.ts.map +1 -0
  8. package/dist/subsystem/SubsystemCarousel.js +163 -0
  9. package/dist/subsystem/SubsystemCarousel.js.map +1 -0
  10. package/dist/subsystem/SubsystemComponentGraph.d.ts +25 -0
  11. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  12. package/dist/subsystem/SubsystemComponentGraph.js +329 -68
  13. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  14. package/package.json +4 -4
  15. package/src/index.ts +9 -199
  16. package/src/subsystem/SubsystemComponentGraph.tsx +396 -50
  17. package/src/components/ConfigurationSelector.tsx +0 -133
  18. package/src/components/GraphRenderer.tsx +0 -3195
  19. package/src/components/MultiCanvasRenderer.tsx +0 -295
  20. package/src/components/NodeTooltip.tsx +0 -279
  21. package/src/components/PendingChanges.test.tsx +0 -375
  22. package/src/components/SelectionSidebar.tsx +0 -352
  23. package/src/components/SequenceDiagramRenderer.tsx +0 -1156
  24. package/src/components/WorkflowSequenceDiagram.tsx +0 -270
  25. package/src/components/dashboard/DashboardRenderer.tsx +0 -317
  26. package/src/components/dashboard/MetricPanel.tsx +0 -254
  27. package/src/components/dashboard/MockDataProvider.ts +0 -330
  28. package/src/components/dashboard/components/BarChart.tsx +0 -299
  29. package/src/components/dashboard/components/LineChart.tsx +0 -279
  30. package/src/components/dashboard/components/MetricCard.tsx +0 -270
  31. package/src/components/dashboard/components/SourceLink.tsx +0 -63
  32. package/src/components/dashboard/components/TimeRangeSelector.tsx +0 -280
  33. package/src/components/dashboard/components/index.ts +0 -5
  34. package/src/components/dashboard/index.ts +0 -47
  35. package/src/components/dashboard/types.ts +0 -126
  36. package/src/components/state-view/PipelineView.tsx +0 -347
  37. package/src/components/state-view/index.ts +0 -14
  38. package/src/components/state-view/types.ts +0 -261
  39. package/src/components/state-view/useStateView.ts +0 -205
  40. package/src/contexts/GraphEditContext.tsx +0 -27
  41. package/src/contexts/TooltipPortalContext.ts +0 -8
  42. package/src/edges/CustomEdge.tsx +0 -402
  43. package/src/edges/GenericEdge.tsx +0 -36
  44. package/src/hooks/usePathBasedEvents.ts +0 -192
  45. package/src/hooks/useSequenceLayout.ts +0 -543
  46. package/src/hooks/useUndoRedo.ts +0 -144
  47. package/src/nodes/CustomNode.tsx +0 -1231
  48. package/src/nodes/GenericNode.tsx +0 -55
  49. package/src/nodes/otel/OtelBoundaryNode.tsx +0 -224
  50. package/src/nodes/otel/OtelEventNode.tsx +0 -225
  51. package/src/nodes/otel/OtelResourceNode.tsx +0 -251
  52. package/src/nodes/otel/OtelScopeNode.tsx +0 -221
  53. package/src/nodes/otel/OtelSpanConventionNode.tsx +0 -295
  54. package/src/nodes/otel/index.ts +0 -23
  55. package/src/nodes/otel/shared/NodeBadges.tsx +0 -295
  56. package/src/nodes/otel/shared/NodeContent.tsx +0 -204
  57. package/src/nodes/otel/shared/index.ts +0 -8
  58. package/src/nodes/otel/shared/types.ts +0 -138
  59. package/src/nodes/otel/shared/useNodeBehavior.ts +0 -114
  60. package/src/stories/Audit/BoundaryNodes.stories.tsx +0 -385
  61. package/src/stories/Audit/CanvasEdgeTypes.stories.tsx +0 -1448
  62. package/src/stories/Audit/CanvasNodeTypes.stories.tsx +0 -1049
  63. package/src/stories/Audit/ColorPriority.stories.tsx +0 -895
  64. package/src/stories/Audit/DiamondBadges.stories.tsx +0 -629
  65. package/src/stories/Audit/NodeDimensionsTesting.stories.tsx +0 -724
  66. package/src/stories/Audit/NodeFieldsAudit.stories.tsx +0 -996
  67. package/src/stories/Audit/NodeFontSizeTesting.stories.tsx +0 -715
  68. package/src/stories/Audit/NodeShapes.stories.tsx +0 -1208
  69. package/src/stories/Audit/WideNodesTesting.stories.tsx +0 -1045
  70. package/src/stories/Components/DashboardRenderer.stories.tsx +0 -263
  71. package/src/stories/Components/GraphRenderer.stories.tsx +0 -3236
  72. package/src/stories/Components/MultiCanvasRenderer.stories.tsx +0 -370
  73. package/src/stories/Components/SequenceDiagram.stories.tsx +0 -255
  74. package/src/stories/Components/StateView.stories.tsx +0 -417
  75. package/src/stories/Components/TraceViewer.stories.tsx +0 -442
  76. package/src/stories/Components/WorkflowSequenceDiagram.stories.tsx +0 -802
  77. package/src/stories/Features/AnimationWorkshop.stories.tsx +0 -727
  78. package/src/stories/Features/ChangeTypeVisual.stories.tsx +0 -67
  79. package/src/stories/Features/EventDrivenAnimations.stories.tsx +0 -513
  80. package/src/stories/Features/MultiConfig.stories.tsx +0 -539
  81. package/src/stories/Layout/ElkEdgeRouting.stories.tsx +0 -539
  82. package/src/stories/Layout/GraphOrientation.stories.tsx +0 -500
  83. package/src/stories/Layout/MultiDirectionalConnections.stories.tsx +0 -352
  84. package/src/stories/Nodes/NodeDefinitionComparison.stories.tsx +0 -560
  85. package/src/stories/Nodes/NodeNameFallbacks.stories.tsx +0 -491
  86. package/src/stories/Nodes/NumericColors.stories.tsx +0 -440
  87. package/src/stories/OTEL/EventNameDisplay.stories.tsx +0 -694
  88. package/src/stories/OTEL/EventNameFallback.stories.tsx +0 -578
  89. package/src/stories/OTEL/OtelComponents.stories.tsx +0 -422
  90. package/src/stories/OTEL/OtelNodeTypesPrototype.stories.tsx +0 -806
  91. package/src/stories/OTEL/RawEventCards.stories.tsx +0 -57
  92. package/src/stories/OTEL/SpanBadges.stories.tsx +0 -840
  93. package/src/stories/OTEL/ValidationEventsCanvas.stories.tsx +0 -209
  94. package/src/stories/RealWorld/BacklogMdCanvases.stories.tsx +0 -721
  95. package/src/stories/RealWorld/FileCitySequence.stories.tsx +0 -516
  96. package/src/stories/RealWorld/RealCanvasFiles.stories.tsx +0 -336
  97. package/src/stories/__traces__/test-run.canvas.json +0 -241
  98. package/src/stories/data/activity-feed-analytics.dashboard.json +0 -300
  99. package/src/stories/data/file-city-images-transformed.otel.canvas.json +0 -295
  100. package/src/stories/data/file-city-workflows.json +0 -269
  101. package/src/stories/data/graph-converter-test-execution.json +0 -443
  102. package/src/stories/data/graph-converter-test.workflow.json +0 -105
  103. package/src/stories/data/graph-converter-validated-execution.json +0 -58
  104. package/src/utils/animationMapping.ts +0 -166
  105. package/src/utils/canvasBounds.ts +0 -146
  106. package/src/utils/graphConverter.ts +0 -148
  107. package/src/utils/iconResolver.tsx +0 -53
  108. package/src/utils/orientationUtils.ts +0 -73
@@ -1,352 +0,0 @@
1
- import React, { useState } from 'react';
2
- import type { NodeState, NodeTypeDefinition } from '@principal-ai/subsystems-core';
3
- import { useTheme } from '@principal-ade/industry-theme';
4
- import { resolveIcon } from '../utils/iconResolver';
5
-
6
- export interface SelectionSidebarProps {
7
- /** Set of selected node IDs */
8
- selectedNodeIds: Set<string>;
9
- /** All nodes in the graph */
10
- nodes: NodeState[];
11
- /** Node type definitions for icons and colors */
12
- nodeTypeDefinitions: Record<string, NodeTypeDefinition>;
13
- /** Callback when sidebar is closed */
14
- onClose: () => void;
15
- }
16
-
17
- interface ExpandedState {
18
- [nodeId: string]: boolean;
19
- }
20
-
21
- /**
22
- * Sidebar that displays information about multiple selected nodes
23
- * Shows name and description for each node, with expandable details
24
- */
25
- export const SelectionSidebar: React.FC<SelectionSidebarProps> = ({
26
- selectedNodeIds,
27
- nodes,
28
- nodeTypeDefinitions,
29
- onClose,
30
- }) => {
31
- const { theme } = useTheme();
32
- const [expandedNodes, setExpandedNodes] = useState<ExpandedState>({});
33
-
34
- // Get the selected nodes in order
35
- const selectedNodes = nodes.filter((n) => selectedNodeIds.has(n.id));
36
-
37
- const toggleExpanded = (nodeId: string) => {
38
- setExpandedNodes((prev) => ({
39
- ...prev,
40
- [nodeId]: !prev[nodeId],
41
- }));
42
- };
43
-
44
- // Internal fields that should not be displayed
45
- const internalFields = [
46
- 'icon',
47
- 'name',
48
- 'description',
49
- 'sources',
50
- 'color',
51
- 'stroke',
52
- 'width',
53
- 'height',
54
- 'canvasType',
55
- 'text',
56
- 'file',
57
- 'url',
58
- 'shape',
59
- 'states',
60
- 'actions',
61
- 'nodeType',
62
- ];
63
-
64
- return (
65
- <div
66
- style={{
67
- position: 'absolute',
68
- top: '60px',
69
- right: '20px',
70
- backgroundColor: theme.colors.background,
71
- color: theme.colors.text,
72
- borderRadius: '8px',
73
- boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
74
- padding: '16px',
75
- minWidth: '280px',
76
- maxWidth: '350px',
77
- maxHeight: 'calc(100vh - 120px)',
78
- overflowY: 'auto',
79
- zIndex: 1000,
80
- border: `1px solid ${theme.colors.border}`,
81
- }}
82
- >
83
- {/* Header */}
84
- <div
85
- style={{
86
- display: 'flex',
87
- justifyContent: 'space-between',
88
- alignItems: 'center',
89
- marginBottom: '12px',
90
- paddingBottom: '8px',
91
- borderBottom: `2px solid ${theme.colors.primary}`,
92
- }}
93
- >
94
- <div style={{ fontWeight: theme.fontWeights.bold, fontSize: theme.fontSizes[1], fontFamily: theme.fonts.body, color: theme.colors.primary }}>
95
- {selectedNodes.length} nodes selected
96
- </div>
97
- <button
98
- onClick={onClose}
99
- style={{
100
- border: 'none',
101
- background: 'none',
102
- cursor: 'pointer',
103
- fontSize: theme.fontSizes[3],
104
- fontFamily: theme.fonts.body,
105
- color: theme.colors.textSecondary,
106
- padding: '0',
107
- width: '24px',
108
- height: '24px',
109
- display: 'flex',
110
- alignItems: 'center',
111
- justifyContent: 'center',
112
- }}
113
- >
114
- x
115
- </button>
116
- </div>
117
-
118
- {/* Node List */}
119
- <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
120
- {selectedNodes.map((node) => {
121
- const typeDefinition = nodeTypeDefinitions[node.type];
122
- const nodeColor =
123
- (node.data?.color as string) || typeDefinition?.color || theme.colors.secondary;
124
- const icon = (node.data?.icon as string) || typeDefinition?.icon;
125
- const isExpanded = expandedNodes[node.id] || false;
126
- const description = node.data?.description as string | undefined;
127
-
128
- // Get displayable data entries
129
- const dataEntries = node.data
130
- ? Object.entries(node.data).filter(([key]) => !internalFields.includes(key))
131
- : [];
132
-
133
- return (
134
- <div
135
- key={node.id}
136
- style={{
137
- backgroundColor: theme.colors.surface,
138
- borderRadius: '6px',
139
- border: `1px solid ${theme.colors.border}`,
140
- overflow: 'hidden',
141
- }}
142
- >
143
- {/* Node Header - Always visible */}
144
- <button
145
- onClick={() => toggleExpanded(node.id)}
146
- style={{
147
- width: '100%',
148
- padding: '10px 12px',
149
- backgroundColor: 'transparent',
150
- border: 'none',
151
- cursor: 'pointer',
152
- display: 'flex',
153
- alignItems: 'flex-start',
154
- gap: '10px',
155
- textAlign: 'left',
156
- }}
157
- >
158
- {/* Icon */}
159
- <div
160
- style={{
161
- width: '28px',
162
- height: '28px',
163
- borderRadius: '6px',
164
- backgroundColor: nodeColor,
165
- display: 'flex',
166
- alignItems: 'center',
167
- justifyContent: 'center',
168
- flexShrink: 0,
169
- color: 'white',
170
- }}
171
- >
172
- {icon ? resolveIcon(icon, 16) : null}
173
- </div>
174
-
175
- {/* Name and Description */}
176
- <div style={{ flex: 1, minWidth: 0 }}>
177
- <div
178
- style={{
179
- fontWeight: theme.fontWeights.semibold,
180
- fontSize: theme.fontSizes[1],
181
- fontFamily: theme.fonts.body,
182
- color: theme.colors.text,
183
- marginBottom: description ? '2px' : 0,
184
- }}
185
- >
186
- {node.name || node.id}
187
- </div>
188
- {description && (
189
- <div
190
- style={{
191
- fontSize: theme.fontSizes[0],
192
- fontFamily: theme.fonts.body,
193
- color: theme.colors.textSecondary,
194
- overflow: 'hidden',
195
- textOverflow: 'ellipsis',
196
- display: '-webkit-box',
197
- WebkitLineClamp: isExpanded ? 'unset' : 2,
198
- WebkitBoxOrient: 'vertical',
199
- }}
200
- >
201
- {description}
202
- </div>
203
- )}
204
- </div>
205
-
206
- {/* Expand/Collapse Indicator */}
207
- <div
208
- style={{
209
- color: theme.colors.textSecondary,
210
- fontSize: '10px',
211
- transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
212
- transition: 'transform 0.2s',
213
- flexShrink: 0,
214
- }}
215
- >
216
- ▼
217
- </div>
218
- </button>
219
-
220
- {/* Expanded Details */}
221
- {isExpanded && (
222
- <div
223
- style={{
224
- padding: '0 12px 10px 12px',
225
- borderTop: `1px solid ${theme.colors.border}`,
226
- marginTop: '0',
227
- }}
228
- >
229
- {/* Node Type */}
230
- <div style={{ marginTop: '10px' }}>
231
- <div
232
- style={{
233
- fontSize: theme.fontSizes[0],
234
- fontFamily: theme.fonts.body,
235
- color: theme.colors.textSecondary,
236
- marginBottom: '4px',
237
- }}
238
- >
239
- Type
240
- </div>
241
- <div
242
- style={{
243
- fontSize: theme.fontSizes[0],
244
- fontFamily: theme.fonts.body,
245
- padding: '3px 8px',
246
- backgroundColor: nodeColor,
247
- color: 'white',
248
- borderRadius: '4px',
249
- display: 'inline-block',
250
- }}
251
- >
252
- {node.type}
253
- </div>
254
- </div>
255
-
256
- {/* Node State */}
257
- {node.state && (
258
- <div style={{ marginTop: '8px' }}>
259
- <div
260
- style={{
261
- fontSize: theme.fontSizes[0],
262
- fontFamily: theme.fonts.body,
263
- color: theme.colors.textSecondary,
264
- marginBottom: '4px',
265
- }}
266
- >
267
- State
268
- </div>
269
- <div
270
- style={{
271
- fontSize: theme.fontSizes[0],
272
- fontFamily: theme.fonts.body,
273
- padding: '3px 8px',
274
- backgroundColor:
275
- typeDefinition?.states?.[node.state]?.color || theme.colors.secondary,
276
- color: 'white',
277
- borderRadius: '4px',
278
- display: 'inline-block',
279
- }}
280
- >
281
- {typeDefinition?.states?.[node.state]?.label || node.state}
282
- </div>
283
- </div>
284
- )}
285
-
286
- {/* Data Properties */}
287
- {dataEntries.length > 0 && (
288
- <div style={{ marginTop: '8px' }}>
289
- <div
290
- style={{
291
- fontSize: theme.fontSizes[0],
292
- fontFamily: theme.fonts.body,
293
- color: theme.colors.textSecondary,
294
- marginBottom: '6px',
295
- fontWeight: 'bold',
296
- }}
297
- >
298
- Properties
299
- </div>
300
- {dataEntries.map(([key, value]) => (
301
- <div key={key} style={{ marginBottom: '6px' }}>
302
- <div
303
- style={{
304
- fontSize: theme.fontSizes[0],
305
- fontFamily: theme.fonts.body,
306
- color: theme.colors.textSecondary,
307
- marginBottom: '2px',
308
- }}
309
- >
310
- {key}
311
- </div>
312
- <div
313
- style={{
314
- fontSize: theme.fontSizes[0],
315
- fontFamily: theme.fonts.body,
316
- color: theme.colors.text,
317
- wordBreak: 'break-word',
318
- }}
319
- >
320
- {value !== undefined && value !== null
321
- ? typeof value === 'object'
322
- ? JSON.stringify(value, null, 2)
323
- : String(value)
324
- : '-'}
325
- </div>
326
- </div>
327
- ))}
328
- </div>
329
- )}
330
-
331
- {/* Node ID */}
332
- <div
333
- style={{
334
- fontSize: theme.fontSizes[0],
335
- fontFamily: theme.fonts.body,
336
- color: theme.colors.textMuted,
337
- marginTop: '8px',
338
- paddingTop: '6px',
339
- borderTop: `1px solid ${theme.colors.border}`,
340
- }}
341
- >
342
- ID: {node.id}
343
- </div>
344
- </div>
345
- )}
346
- </div>
347
- );
348
- })}
349
- </div>
350
- </div>
351
- );
352
- };