@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,539 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { useState } from 'react';
3
- import { GraphRenderer } from '../../components/GraphRenderer';
4
- import type { ExtendedCanvas } from '@principal-ai/subsystems-core';
5
- import React from 'react';
6
- import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
7
-
8
- const meta: Meta<typeof GraphRenderer> = {
9
- title: 'Features/MultiConfig',
10
- component: GraphRenderer,
11
- parameters: {
12
- layout: 'fullscreen',
13
- },
14
- tags: ['autodocs'],
15
- decorators: [
16
- (Story) => (
17
- <ThemeProvider theme={defaultEditorTheme}>
18
- <Story />
19
- </ThemeProvider>
20
- ),
21
- ],
22
- };
23
-
24
- export default meta;
25
- type Story = StoryObj<typeof GraphRenderer>;
26
-
27
- // ============================================================================
28
- // Sample Canvas Configurations
29
- // ============================================================================
30
-
31
- /**
32
- * Simple Service Architecture Canvas
33
- */
34
- const simpleServiceCanvas: ExtendedCanvas = {
35
- nodes: [
36
- {
37
- id: 'api-1',
38
- type: 'text',
39
- x: 100,
40
- y: 150,
41
- width: 120,
42
- height: 70,
43
- text: 'API',
44
- color: '#4A90E2',
45
- pv: {
46
- nodeType: 'api',
47
- shape: 'rectangle',
48
- icon: 'Globe',
49
- },
50
- },
51
- {
52
- id: 'service-1',
53
- type: 'text',
54
- x: 300,
55
- y: 150,
56
- width: 100,
57
- height: 100,
58
- text: 'Service',
59
- color: '#7ED321',
60
- pv: {
61
- nodeType: 'service',
62
- shape: 'hexagon',
63
- icon: 'Cog',
64
- },
65
- },
66
- {
67
- id: 'database-1',
68
- type: 'text',
69
- x: 500,
70
- y: 150,
71
- width: 80,
72
- height: 80,
73
- text: 'Database',
74
- color: '#BD10E0',
75
- pv: {
76
- nodeType: 'database',
77
- shape: 'circle',
78
- icon: 'Database',
79
- },
80
- },
81
- ],
82
- edges: [
83
- {
84
- id: 'edge-1',
85
- fromNode: 'api-1',
86
- toNode: 'service-1',
87
- pv: { edgeType: 'api_call' },
88
- },
89
- {
90
- id: 'edge-2',
91
- fromNode: 'service-1',
92
- toNode: 'database-1',
93
- pv: { edgeType: 'data_access' },
94
- },
95
- ],
96
- pv: {
97
- version: '1.0.0',
98
- name: 'Simple Service',
99
- description: 'Basic 3-tier service architecture',
100
- edgeTypes: {
101
- api_call: {
102
- style: 'solid',
103
- color: '#4A90E2',
104
- width: 2,
105
- directed: true,
106
- },
107
- data_access: {
108
- style: 'dashed',
109
- color: '#BD10E0',
110
- width: 2,
111
- directed: true,
112
- },
113
- },
114
- },
115
- };
116
-
117
- /**
118
- * Microservices Architecture Canvas
119
- */
120
- const microservicesCanvas: ExtendedCanvas = {
121
- nodes: [
122
- {
123
- id: 'gateway-1',
124
- type: 'text',
125
- x: 300,
126
- y: 50,
127
- width: 120,
128
- height: 70,
129
- text: 'Gateway',
130
- color: '#00C853',
131
- pv: {
132
- nodeType: 'gateway',
133
- shape: 'rectangle',
134
- icon: 'Network',
135
- },
136
- },
137
- {
138
- id: 'auth-1',
139
- type: 'text',
140
- x: 100,
141
- y: 200,
142
- width: 120,
143
- height: 70,
144
- text: 'Auth Service',
145
- color: '#FF6B6B',
146
- pv: {
147
- nodeType: 'auth_service',
148
- shape: 'rectangle',
149
- icon: 'Lock',
150
- },
151
- },
152
- {
153
- id: 'user-1',
154
- type: 'text',
155
- x: 300,
156
- y: 200,
157
- width: 120,
158
- height: 70,
159
- text: 'User Service',
160
- color: '#4A90E2',
161
- pv: {
162
- nodeType: 'user_service',
163
- shape: 'rectangle',
164
- icon: 'Users',
165
- },
166
- },
167
- {
168
- id: 'cache-1',
169
- type: 'text',
170
- x: 100,
171
- y: 350,
172
- width: 80,
173
- height: 80,
174
- text: 'Cache',
175
- color: '#3498DB',
176
- pv: {
177
- nodeType: 'cache',
178
- shape: 'circle',
179
- icon: 'Zap',
180
- },
181
- },
182
- {
183
- id: 'db-1',
184
- type: 'text',
185
- x: 300,
186
- y: 350,
187
- width: 80,
188
- height: 80,
189
- text: 'Database',
190
- color: '#27AE60',
191
- pv: {
192
- nodeType: 'database',
193
- shape: 'circle',
194
- icon: 'Database',
195
- },
196
- },
197
- ],
198
- edges: [
199
- {
200
- id: 'edge-1',
201
- fromNode: 'gateway-1',
202
- toNode: 'auth-1',
203
- pv: { edgeType: 'http_request' },
204
- },
205
- {
206
- id: 'edge-2',
207
- fromNode: 'gateway-1',
208
- toNode: 'user-1',
209
- pv: { edgeType: 'http_request' },
210
- },
211
- {
212
- id: 'edge-3',
213
- fromNode: 'auth-1',
214
- toNode: 'cache-1',
215
- pv: { edgeType: 'cache_access' },
216
- },
217
- {
218
- id: 'edge-4',
219
- fromNode: 'user-1',
220
- toNode: 'db-1',
221
- pv: { edgeType: 'http_request' },
222
- },
223
- ],
224
- pv: {
225
- version: '2.0.0',
226
- name: 'Microservices',
227
- description: 'Distributed microservices architecture',
228
- edgeTypes: {
229
- http_request: {
230
- style: 'solid',
231
- color: '#4A90E2',
232
- width: 2,
233
- directed: true,
234
- animation: {
235
- type: 'flow',
236
- duration: 1500,
237
- },
238
- },
239
- cache_access: {
240
- style: 'dotted',
241
- color: '#3498DB',
242
- width: 2,
243
- directed: true,
244
- },
245
- },
246
- },
247
- };
248
-
249
- /**
250
- * Data Pipeline Canvas
251
- */
252
- const dataPipelineCanvas: ExtendedCanvas = {
253
- nodes: [
254
- {
255
- id: 'source-1',
256
- type: 'text',
257
- x: 100,
258
- y: 150,
259
- width: 120,
260
- height: 70,
261
- text: 'Data Source',
262
- color: '#6C5CE7',
263
- pv: {
264
- nodeType: 'data_source',
265
- shape: 'rectangle',
266
- icon: 'FileInput',
267
- },
268
- },
269
- {
270
- id: 'validator-1',
271
- type: 'text',
272
- x: 280,
273
- y: 150,
274
- width: 90,
275
- height: 90,
276
- text: 'Validator',
277
- color: '#00B894',
278
- pv: {
279
- nodeType: 'validator',
280
- shape: 'diamond',
281
- icon: 'CheckCircle',
282
- },
283
- },
284
- {
285
- id: 'transformer-1',
286
- type: 'text',
287
- x: 450,
288
- y: 150,
289
- width: 100,
290
- height: 100,
291
- text: 'Transformer',
292
- color: '#FD79A8',
293
- pv: {
294
- nodeType: 'transformer',
295
- shape: 'hexagon',
296
- icon: 'RefreshCw',
297
- },
298
- },
299
- {
300
- id: 'warehouse-1',
301
- type: 'text',
302
- x: 620,
303
- y: 150,
304
- width: 80,
305
- height: 80,
306
- text: 'Warehouse',
307
- color: '#0984E3',
308
- pv: {
309
- nodeType: 'data_warehouse',
310
- shape: 'circle',
311
- icon: 'Database',
312
- },
313
- },
314
- ],
315
- edges: [
316
- {
317
- id: 'edge-1',
318
- fromNode: 'source-1',
319
- toNode: 'validator-1',
320
- pv: { edgeType: 'validation_flow' },
321
- },
322
- {
323
- id: 'edge-2',
324
- fromNode: 'validator-1',
325
- toNode: 'transformer-1',
326
- pv: { edgeType: 'data_flow' },
327
- },
328
- {
329
- id: 'edge-3',
330
- fromNode: 'transformer-1',
331
- toNode: 'warehouse-1',
332
- pv: { edgeType: 'data_flow' },
333
- },
334
- ],
335
- pv: {
336
- version: '1.0.0',
337
- name: 'Data Pipeline',
338
- description: 'ETL data processing pipeline',
339
- edgeTypes: {
340
- data_flow: {
341
- style: 'solid',
342
- color: '#0984E3',
343
- width: 3,
344
- directed: true,
345
- animation: {
346
- type: 'flow',
347
- duration: 2000,
348
- },
349
- },
350
- validation_flow: {
351
- style: 'solid',
352
- color: '#00B894',
353
- width: 2,
354
- directed: true,
355
- },
356
- },
357
- },
358
- };
359
-
360
- // Available configurations
361
- const configurations = [
362
- { name: 'Simple Service', canvas: simpleServiceCanvas },
363
- { name: 'Microservices', canvas: microservicesCanvas },
364
- { name: 'Data Pipeline', canvas: dataPipelineCanvas },
365
- ];
366
-
367
- // Multi-config switcher component
368
- function MultiConfigDemo() {
369
- const [selectedConfigName, setSelectedConfigName] = useState(configurations[0].name);
370
-
371
- const selectedConfig = configurations.find((c) => c.name === selectedConfigName);
372
-
373
- if (!selectedConfig) {
374
- return <div>No configuration selected</div>;
375
- }
376
-
377
- return (
378
- <div style={{ width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column' }}>
379
- {/* Header with configuration selector */}
380
- <div
381
- style={{
382
- padding: '16px',
383
- backgroundColor: '#f5f5f5',
384
- borderBottom: '1px solid #ddd',
385
- }}
386
- >
387
- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
388
- <label style={{ fontWeight: 'bold' }}>Configuration:</label>
389
- <select
390
- value={selectedConfigName}
391
- onChange={(e) => setSelectedConfigName(e.target.value)}
392
- style={{
393
- padding: '8px 12px',
394
- borderRadius: '4px',
395
- border: '1px solid #ccc',
396
- fontSize: '14px',
397
- minWidth: '200px',
398
- }}
399
- >
400
- {configurations.map((config) => (
401
- <option key={config.name} value={config.name}>
402
- {config.name}
403
- </option>
404
- ))}
405
- </select>
406
- <span style={{ color: '#666', fontSize: '12px' }}>
407
- {selectedConfig.canvas.pv?.description}
408
- </span>
409
- </div>
410
- </div>
411
-
412
- {/* Graph visualization */}
413
- <div style={{ flex: 1 }}>
414
- <GraphRenderer canvas={selectedConfig.canvas} showControls showBackground />
415
- </div>
416
- </div>
417
- );
418
- }
419
-
420
- // Story: Basic multi-config switcher
421
- export const ConfigurationSwitcher: Story = {
422
- render: () => <MultiConfigDemo />,
423
- parameters: {
424
- docs: {
425
- description: {
426
- story:
427
- 'Demonstrates switching between multiple graph configurations. Each configuration has different node types, edge types, and visual styles. Use the dropdown to switch between configurations.',
428
- },
429
- },
430
- },
431
- };
432
-
433
- // Side-by-side comparison component
434
- function SideBySideDemo() {
435
- const [leftConfigName, setLeftConfigName] = useState(configurations[0].name);
436
- const [rightConfigName, setRightConfigName] = useState(configurations[1].name);
437
-
438
- const leftConfig = configurations.find((c) => c.name === leftConfigName);
439
- const rightConfig = configurations.find((c) => c.name === rightConfigName);
440
-
441
- return (
442
- <div style={{ width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column' }}>
443
- {/* Header */}
444
- <div
445
- style={{
446
- padding: '16px',
447
- backgroundColor: '#f5f5f5',
448
- borderBottom: '1px solid #ddd',
449
- display: 'flex',
450
- gap: '16px',
451
- }}
452
- >
453
- <div style={{ flex: 1 }}>
454
- <label style={{ fontWeight: 'bold', display: 'block', marginBottom: '4px' }}>
455
- Left Configuration
456
- </label>
457
- <select
458
- value={leftConfigName}
459
- onChange={(e) => setLeftConfigName(e.target.value)}
460
- style={{
461
- padding: '8px 12px',
462
- borderRadius: '4px',
463
- border: '1px solid #ccc',
464
- fontSize: '14px',
465
- width: '100%',
466
- }}
467
- >
468
- {configurations.map((config) => (
469
- <option key={config.name} value={config.name}>
470
- {config.name}
471
- </option>
472
- ))}
473
- </select>
474
- </div>
475
- <div style={{ flex: 1 }}>
476
- <label style={{ fontWeight: 'bold', display: 'block', marginBottom: '4px' }}>
477
- Right Configuration
478
- </label>
479
- <select
480
- value={rightConfigName}
481
- onChange={(e) => setRightConfigName(e.target.value)}
482
- style={{
483
- padding: '8px 12px',
484
- borderRadius: '4px',
485
- border: '1px solid #ccc',
486
- fontSize: '14px',
487
- width: '100%',
488
- }}
489
- >
490
- {configurations.map((config) => (
491
- <option key={config.name} value={config.name}>
492
- {config.name}
493
- </option>
494
- ))}
495
- </select>
496
- </div>
497
- </div>
498
-
499
- {/* Side by side graphs */}
500
- <div style={{ flex: 1, display: 'flex' }}>
501
- {leftConfig && (
502
- <div style={{ flex: 1, borderRight: '1px solid #ddd' }}>
503
- <GraphRenderer
504
- canvas={leftConfig.canvas}
505
- configName={leftConfigName}
506
- showMinimap={false}
507
- showControls
508
- showBackground
509
- />
510
- </div>
511
- )}
512
- {rightConfig && (
513
- <div style={{ flex: 1 }}>
514
- <GraphRenderer
515
- canvas={rightConfig.canvas}
516
- configName={rightConfigName}
517
- showMinimap={false}
518
- showControls
519
- showBackground
520
- />
521
- </div>
522
- )}
523
- </div>
524
- </div>
525
- );
526
- }
527
-
528
- // Story: Side-by-side comparison
529
- export const SideBySideComparison: Story = {
530
- render: () => <SideBySideDemo />,
531
- parameters: {
532
- docs: {
533
- description: {
534
- story:
535
- 'Compare two different graph configurations side-by-side. Useful for understanding architectural differences or analyzing multiple aspects of your system simultaneously.',
536
- },
537
- },
538
- },
539
- };