@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,422 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import React from 'react';
3
- import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
4
- import { GraphRenderer } from '../../components/GraphRenderer';
5
- import { NodeTooltip } from '../../components/NodeTooltip';
6
-
7
- // OTEL Log Association canvas data
8
- const otelCanvas = {
9
- nodes: [
10
- {
11
- id: 'otel-log',
12
- type: 'text',
13
- text: 'OtelLog',
14
- x: -304,
15
- y: 147,
16
- width: 120,
17
- height: 118,
18
- pv: {
19
- nodeType: 'otel-type',
20
- name: 'OtelLog',
21
- description: `## OpenTelemetry Log Record
22
-
23
- A structured log entry containing:
24
- - **Timestamp**: When the log was created
25
- - **Severity**: Log level (INFO, WARN, ERROR)
26
- - **Body**: The actual log message
27
- - **Resource**: Source context
28
- - **Trace Context**: Correlation with traces
29
-
30
- \`\`\`typescript
31
- interface OtelLog {
32
- timestamp: number;
33
- severity: string;
34
- body: string;
35
- }
36
- \`\`\``,
37
- otel: {
38
- kind: 'type',
39
- category: 'log',
40
- },
41
- shape: 'rectangle',
42
- icon: 'FileText',
43
- fill: '#4A90E2',
44
- },
45
- },
46
- {
47
- id: 'log-router',
48
- type: 'text',
49
- text: 'LogRouter',
50
- x: -80,
51
- y: 150,
52
- width: 130,
53
- height: 118,
54
- pv: {
55
- nodeType: 'otel-service',
56
- name: 'LogRouter',
57
- description: `### Log Router Service
58
-
59
- Routes incoming OTEL logs to canvas nodes based on matching criteria.
60
-
61
- **Routing Logic:**
62
- 1. Check canvas scope match
63
- 2. Apply \`resourceMatch\` patterns
64
- 3. Route to matching nodes
65
- 4. Collect orphaned logs
66
-
67
- > **Note**: Supports multiple match operators including \`exact\`, \`glob\`, and \`regex\`.`,
68
- otel: {
69
- kind: 'service',
70
- category: 'router',
71
- },
72
- shape: 'hexagon',
73
- icon: 'GitBranch',
74
- fill: '#7ED321',
75
- },
76
- },
77
- {
78
- id: 'orphaned-log',
79
- type: 'text',
80
- text: 'OrphanedLog',
81
- x: 150,
82
- y: 150,
83
- width: 127,
84
- height: 118,
85
- pv: {
86
- nodeType: 'otel-type',
87
- name: 'OrphanedLog',
88
- description:
89
- 'Logs that matched canvas scope but no node resourceMatch - indicates missing nodes or misconfiguration',
90
- otel: {
91
- kind: 'type',
92
- category: 'audit',
93
- },
94
- shape: 'rectangle',
95
- icon: 'AlertTriangle',
96
- fill: '#D0021B',
97
- },
98
- },
99
- {
100
- id: 'match-operator',
101
- type: 'text',
102
- text: 'MatchOperator',
103
- x: -80,
104
- y: 300,
105
- width: 120,
106
- height: 117,
107
- pv: {
108
- nodeType: 'service',
109
- name: 'MatchOperator',
110
- description: 'Matching operators: exact, glob, regex, exists, oneOf',
111
- shape: 'diamond',
112
- icon: 'Code',
113
- fill: '#F5A623',
114
- },
115
- },
116
- ],
117
- edges: [
118
- {
119
- id: 'log-to-router',
120
- fromNode: 'otel-log',
121
- toNode: 'log-router',
122
- fromSide: 'right',
123
- toSide: 'left',
124
- label: 'route()',
125
- },
126
- {
127
- id: 'router-to-orphan',
128
- fromNode: 'log-router',
129
- toNode: 'orphaned-log',
130
- fromSide: 'right',
131
- toSide: 'left',
132
- label: 'unmatched',
133
- },
134
- {
135
- id: 'router-to-operator',
136
- fromNode: 'log-router',
137
- toNode: 'match-operator',
138
- fromSide: 'bottom',
139
- toSide: 'top',
140
- label: 'uses',
141
- },
142
- ],
143
- pv: {
144
- version: '1.0.0',
145
- name: 'OTEL Components Demo',
146
- description: 'Demonstrates OTEL badges, tooltips, and info panel',
147
- nodeTypes: {
148
- 'otel-type': {
149
- label: 'Type',
150
- description: 'TypeScript type or interface representing OTEL concepts',
151
- shape: 'rectangle',
152
- },
153
- 'otel-service': {
154
- label: 'Service',
155
- description: 'Runtime service component for OTEL processing',
156
- shape: 'hexagon',
157
- },
158
- service: {
159
- label: 'Component',
160
- description: 'System component',
161
- shape: 'hexagon',
162
- },
163
- },
164
- },
165
- };
166
-
167
- const meta: Meta = {
168
- title: 'OTEL/OtelComponents',
169
- parameters: {
170
- layout: 'fullscreen',
171
- },
172
- };
173
-
174
- export default meta;
175
-
176
- /**
177
- * Shows nodes with OTEL badges (T/S/I circles) and hover tooltips.
178
- * Hover over any node to see the tooltip with OTEL kind, category, and description.
179
- */
180
- export const OtelBadgesAndTooltips: StoryObj = {
181
- render: () => (
182
- <ThemeProvider theme={defaultEditorTheme}>
183
- <div style={{ width: '100%', height: '600px' }}>
184
- <GraphRenderer canvas={otelCanvas} initialViewport={{ x: 200, y: 50, zoom: 1 }} />
185
- </div>
186
- </ThemeProvider>
187
- ),
188
- };
189
-
190
- /**
191
- * Standalone NodeTooltip component demo showing all OTEL kinds.
192
- */
193
- export const TooltipVariants: StoryObj = {
194
- render: () => (
195
- <ThemeProvider theme={defaultEditorTheme}>
196
- <div style={{ padding: '40px', display: 'flex', gap: '80px', flexWrap: 'wrap' }}>
197
- <div style={{ position: 'relative', width: '200px', height: '150px' }}>
198
- <div
199
- style={{
200
- padding: '20px',
201
- border: '2px solid #4A90E2',
202
- borderRadius: '8px',
203
- textAlign: 'center',
204
- }}
205
- >
206
- Type Node (hover below)
207
- </div>
208
- <NodeTooltip
209
- description="OpenTelemetry log record with timestamp, severity, body"
210
- otel={{ kind: 'type', category: 'log' }}
211
- visible={true}
212
- />
213
- </div>
214
-
215
- <div style={{ position: 'relative', width: '200px', height: '150px' }}>
216
- <div
217
- style={{
218
- padding: '20px',
219
- border: '2px solid #7ED321',
220
- borderRadius: '8px',
221
- textAlign: 'center',
222
- }}
223
- >
224
- Service Node (hover below)
225
- </div>
226
- <NodeTooltip
227
- description="Routes logs to canvas nodes based on resourceMatch"
228
- otel={{ kind: 'service', category: 'router' }}
229
- visible={true}
230
- />
231
- </div>
232
-
233
- <div style={{ position: 'relative', width: '200px', height: '150px' }}>
234
- <div
235
- style={{
236
- padding: '20px',
237
- border: '2px solid #9B59B6',
238
- borderRadius: '8px',
239
- textAlign: 'center',
240
- }}
241
- >
242
- Instance Node (hover below)
243
- </div>
244
- <NodeTooltip
245
- description="A specific running instance of a service"
246
- otel={{ kind: 'instance', category: 'runtime', scope: 'auth-flow' }}
247
- visible={true}
248
- />
249
- </div>
250
- </div>
251
- </ThemeProvider>
252
- ),
253
- };
254
-
255
- /**
256
- * Demonstrates tooltips with scope information.
257
- * Shows how scope names are displayed in the tooltip.
258
- */
259
- export const TooltipWithScope: StoryObj = {
260
- render: () => (
261
- <ThemeProvider theme={defaultEditorTheme}>
262
- <div style={{ padding: '40px', display: 'flex', gap: '80px', flexWrap: 'wrap' }}>
263
- <div style={{ position: 'relative', width: '200px', height: '180px' }}>
264
- <div
265
- style={{
266
- padding: '20px',
267
- border: '2px solid #DC2626',
268
- borderRadius: '8px',
269
- textAlign: 'center',
270
- backgroundColor: '#DC2626',
271
- color: 'white',
272
- }}
273
- >
274
- Auth Event
275
- </div>
276
- <NodeTooltip
277
- description="User authentication completed successfully"
278
- otel={{ kind: 'type', category: 'event', scope: 'auth-flow' }}
279
- visible={true}
280
- />
281
- </div>
282
-
283
- <div style={{ position: 'relative', width: '200px', height: '180px' }}>
284
- <div
285
- style={{
286
- padding: '20px',
287
- border: '2px solid #2563EB',
288
- borderRadius: '8px',
289
- textAlign: 'center',
290
- backgroundColor: '#2563EB',
291
- color: 'white',
292
- }}
293
- >
294
- Terminal Event
295
- </div>
296
- <NodeTooltip
297
- description="Command executed in terminal session"
298
- otel={{ kind: 'type', category: 'event', scope: 'terminal-activity' }}
299
- visible={true}
300
- />
301
- </div>
302
-
303
- <div style={{ position: 'relative', width: '200px', height: '180px' }}>
304
- <div
305
- style={{
306
- padding: '20px',
307
- border: '2px solid #16A34A',
308
- borderRadius: '8px',
309
- textAlign: 'center',
310
- backgroundColor: '#16A34A',
311
- color: 'white',
312
- }}
313
- >
314
- Quality Event
315
- </div>
316
- <NodeTooltip
317
- description="Code quality check completed with metrics"
318
- otel={{ kind: 'type', category: 'event', scope: 'quality-panel' }}
319
- visible={true}
320
- />
321
- </div>
322
- </div>
323
- </ThemeProvider>
324
- ),
325
- };
326
-
327
- /**
328
- * Demonstrates markdown rendering in tooltips with rich formatting.
329
- * Hold Shift and hover over nodes to see tooltips with markdown content.
330
- */
331
- export const MarkdownTooltips: StoryObj = {
332
- render: () => (
333
- <ThemeProvider theme={defaultEditorTheme}>
334
- <div style={{ padding: '40px', display: 'flex', gap: '80px', flexWrap: 'wrap' }}>
335
- <div style={{ position: 'relative', width: '200px', height: '200px' }}>
336
- <div
337
- style={{
338
- padding: '20px',
339
- border: '2px solid #4A90E2',
340
- borderRadius: '8px',
341
- textAlign: 'center',
342
- }}
343
- >
344
- Lists & Code (hover below)
345
- </div>
346
- <NodeTooltip
347
- description={`# Features
348
-
349
- - **Bold text** and *italic text*
350
- - Inline \`code\` formatting
351
- - Multiple levels of formatting
352
-
353
- ## Code Example
354
- \`\`\`typescript
355
- function example() {
356
- return "Hello!";
357
- }
358
- \`\`\`
359
- `}
360
- otel={{ kind: 'type', category: 'example' }}
361
- visible={true}
362
- />
363
- </div>
364
-
365
- <div style={{ position: 'relative', width: '200px', height: '200px' }}>
366
- <div
367
- style={{
368
- padding: '20px',
369
- border: '2px solid #7ED321',
370
- borderRadius: '8px',
371
- textAlign: 'center',
372
- }}
373
- >
374
- Links & Emphasis (hover below)
375
- </div>
376
- <NodeTooltip
377
- description={`## Service Router
378
-
379
- This component handles:
380
-
381
- 1. Log routing
382
- 2. Pattern matching
383
- 3. Event distribution
384
-
385
- **Important**: Uses [regex](https://regex.org) for matching.
386
-
387
- > Note: All logs are buffered before routing.`}
388
- otel={{ kind: 'service', category: 'router' }}
389
- visible={true}
390
- />
391
- </div>
392
-
393
- <div style={{ position: 'relative', width: '200px', height: '200px' }}>
394
- <div
395
- style={{
396
- padding: '20px',
397
- border: '2px solid #9B59B6',
398
- borderRadius: '8px',
399
- textAlign: 'center',
400
- }}
401
- >
402
- Tables (hover below)
403
- </div>
404
- <NodeTooltip
405
- description={`### Configuration
406
-
407
- | Property | Type | Default |
408
- |----------|------|---------|
409
- | timeout | number | 5000 |
410
- | retries | number | 3 |
411
- | enabled | boolean | true |
412
-
413
- Use \`config.json\` to customize.`}
414
- otel={{ kind: 'instance', category: 'config' }}
415
- visible={true}
416
- />
417
- </div>
418
- </div>
419
- </ThemeProvider>
420
- ),
421
- };
422
-