@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,1208 +0,0 @@
1
- import React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../../components/GraphRenderer';
4
- import type { ExtendedCanvas } from '@principal-ai/subsystems-core';
5
- import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
-
7
- const meta = {
8
- title: 'Audit/NodeShapes',
9
- component: GraphRenderer,
10
- parameters: {
11
- layout: 'centered',
12
- },
13
- tags: ['autodocs'],
14
- decorators: [
15
- (Story) => (
16
- <ThemeProvider theme={defaultEditorTheme}>
17
- <Story />
18
- </ThemeProvider>
19
- ),
20
- ],
21
- } satisfies Meta<typeof GraphRenderer>;
22
-
23
- export default meta;
24
- type Story = StoryObj<typeof meta>;
25
-
26
- /**
27
- * Canvas showing all available node shapes for visual auditing
28
- */
29
- const allShapesCanvas: ExtendedCanvas = {
30
- nodes: [
31
- // Row 1: Basic shapes
32
- {
33
- id: 'rectangle',
34
- type: 'text',
35
- x: 100,
36
- y: 100,
37
- width: 140,
38
- height: 80,
39
- text: '# Rectangle\nDefault shape',
40
- color: 6, // purple
41
- pv: {
42
- nodeType: 'rectangle-demo',
43
- shape: 'rectangle',
44
- icon: 'Square',
45
- },
46
- },
47
- {
48
- id: 'circle',
49
- type: 'text',
50
- x: 300,
51
- y: 100,
52
- width: 100,
53
- height: 100,
54
- text: '# Circle',
55
- color: 5, // cyan
56
- pv: {
57
- nodeType: 'circle-demo',
58
- shape: 'circle',
59
- icon: 'Circle',
60
- },
61
- },
62
- {
63
- id: 'hexagon',
64
- type: 'text',
65
- x: 480,
66
- y: 100,
67
- width: 120,
68
- height: 120,
69
- text: '# Hexagon',
70
- color: 4, // green
71
- pv: {
72
- nodeType: 'hexagon-demo',
73
- shape: 'hexagon',
74
- icon: 'Hexagon',
75
- size: { width: 120, height: 120 },
76
- },
77
- },
78
- {
79
- id: 'diamond',
80
- type: 'text',
81
- x: 680,
82
- y: 100,
83
- width: 70,
84
- height: 70,
85
- text: 'Diamond',
86
- color: 2, // orange
87
- pv: {
88
- nodeType: 'diamond-demo',
89
- shape: 'diamond',
90
- icon: 'Diamond',
91
- size: { width: 70, height: 70 },
92
- },
93
- },
94
- {
95
- id: 'custom',
96
- type: 'text',
97
- x: 860,
98
- y: 100,
99
- width: 140,
100
- height: 80,
101
- text: '# Custom\n(Falls back to rect)',
102
- color: 1, // red
103
- pv: {
104
- nodeType: 'custom-demo',
105
- shape: 'custom',
106
- icon: 'Settings',
107
- },
108
- },
109
- ],
110
- edges: [],
111
- pv: {
112
- version: '1.0.0',
113
- name: 'Node Shapes Audit',
114
- description: 'All available node shapes for visual inspection',
115
- edgeTypes: {},
116
- },
117
- };
118
-
119
- export const AllShapes: Story = {
120
- args: {
121
- canvas: allShapesCanvas,
122
- width: 1100,
123
- height: 350,
124
- },
125
- parameters: {
126
- docs: {
127
- description: {
128
- story: `
129
- **All Node Shapes**
130
-
131
- This story displays all 5 available node shapes:
132
- - **Rectangle** - Default shape with rounded corners (borderRadius: 8px)
133
- - **Circle** - Circular nodes (borderRadius: 50%)
134
- - **Hexagon** - Flat-top style using clip-path polygon
135
- - **Diamond** - Diamond shape using clip-path polygon (works with any aspect ratio)
136
- - **Custom** - Placeholder that falls back to rectangle styling
137
- `,
138
- },
139
- },
140
- },
141
- };
142
-
143
- /**
144
- * Canvas showing shapes with different sizes
145
- */
146
- const shapeSizesCanvas: ExtendedCanvas = {
147
- nodes: [
148
- // Small shapes
149
- {
150
- id: 'rect-small',
151
- type: 'text',
152
- x: 100,
153
- y: 80,
154
- width: 80,
155
- height: 50,
156
- text: 'Small',
157
- color: 6,
158
- pv: {
159
- nodeType: 'rect-small',
160
- shape: 'rectangle',
161
- size: { width: 80, height: 50 },
162
- },
163
- },
164
- {
165
- id: 'circle-small',
166
- type: 'text',
167
- x: 250,
168
- y: 80,
169
- width: 60,
170
- height: 60,
171
- text: 'S',
172
- color: 5,
173
- pv: {
174
- nodeType: 'circle-small',
175
- shape: 'circle',
176
- size: { width: 60, height: 60 },
177
- },
178
- },
179
- {
180
- id: 'hex-small',
181
- type: 'text',
182
- x: 380,
183
- y: 80,
184
- width: 80,
185
- height: 60,
186
- text: 'Small',
187
- color: 4,
188
- pv: {
189
- nodeType: 'hex-small',
190
- shape: 'hexagon',
191
- size: { width: 80, height: 60 },
192
- },
193
- },
194
- {
195
- id: 'diamond-small',
196
- type: 'text',
197
- x: 520,
198
- y: 80,
199
- width: 60,
200
- height: 60,
201
- text: 'S',
202
- color: 2,
203
- pv: {
204
- nodeType: 'diamond-small',
205
- shape: 'diamond',
206
- size: { width: 60, height: 60 },
207
- },
208
- },
209
-
210
- // Medium shapes (default)
211
- {
212
- id: 'rect-medium',
213
- type: 'text',
214
- x: 100,
215
- y: 200,
216
- width: 120,
217
- height: 70,
218
- text: 'Medium',
219
- color: 6,
220
- pv: {
221
- nodeType: 'rect-medium',
222
- shape: 'rectangle',
223
- },
224
- },
225
- {
226
- id: 'circle-medium',
227
- type: 'text',
228
- x: 250,
229
- y: 200,
230
- width: 80,
231
- height: 80,
232
- text: 'M',
233
- color: 5,
234
- pv: {
235
- nodeType: 'circle-medium',
236
- shape: 'circle',
237
- },
238
- },
239
- {
240
- id: 'hex-medium',
241
- type: 'text',
242
- x: 380,
243
- y: 200,
244
- width: 100,
245
- height: 80,
246
- text: 'Medium',
247
- color: 4,
248
- pv: {
249
- nodeType: 'hex-medium',
250
- shape: 'hexagon',
251
- },
252
- },
253
- {
254
- id: 'diamond-medium',
255
- type: 'text',
256
- x: 520,
257
- y: 200,
258
- width: 80,
259
- height: 80,
260
- text: 'M',
261
- color: 2,
262
- pv: {
263
- nodeType: 'diamond-medium',
264
- shape: 'diamond',
265
- },
266
- },
267
-
268
- // Large shapes
269
- {
270
- id: 'rect-large',
271
- type: 'text',
272
- x: 100,
273
- y: 340,
274
- width: 180,
275
- height: 100,
276
- text: '# Large\nWith content',
277
- color: 6,
278
- pv: {
279
- nodeType: 'rect-large',
280
- shape: 'rectangle',
281
- size: { width: 180, height: 100 },
282
- },
283
- },
284
- {
285
- id: 'circle-large',
286
- type: 'text',
287
- x: 250,
288
- y: 340,
289
- width: 120,
290
- height: 120,
291
- text: 'Large',
292
- color: 5,
293
- pv: {
294
- nodeType: 'circle-large',
295
- shape: 'circle',
296
- size: { width: 120, height: 120 },
297
- },
298
- },
299
- {
300
- id: 'hex-large',
301
- type: 'text',
302
- x: 380,
303
- y: 340,
304
- width: 140,
305
- height: 110,
306
- text: 'Large',
307
- color: 4,
308
- pv: {
309
- nodeType: 'hex-large',
310
- shape: 'hexagon',
311
- size: { width: 140, height: 110 },
312
- },
313
- },
314
- {
315
- id: 'diamond-large',
316
- type: 'text',
317
- x: 520,
318
- y: 340,
319
- width: 110,
320
- height: 110,
321
- text: 'Large',
322
- color: 2,
323
- pv: {
324
- nodeType: 'diamond-large',
325
- shape: 'diamond',
326
- size: { width: 110, height: 110 },
327
- },
328
- },
329
- ],
330
- edges: [],
331
- pv: {
332
- version: '1.0.0',
333
- name: 'Node Sizes Audit',
334
- description: 'Node shapes at different sizes',
335
- edgeTypes: {},
336
- },
337
- };
338
-
339
- export const ShapeSizes: Story = {
340
- args: {
341
- canvas: shapeSizesCanvas,
342
- width: 700,
343
- height: 550,
344
- },
345
- parameters: {
346
- docs: {
347
- description: {
348
- story: `
349
- **Shape Sizes**
350
-
351
- Shows each shape at small, medium, and large sizes to verify scaling behavior.
352
- `,
353
- },
354
- },
355
- },
356
- };
357
-
358
- /**
359
- * Canvas showing shapes with icons
360
- */
361
- const shapesWithIconsCanvas: ExtendedCanvas = {
362
- nodes: [
363
- {
364
- id: 'rect-icon',
365
- type: 'text',
366
- x: 100,
367
- y: 100,
368
- width: 140,
369
- height: 80,
370
- text: 'Server',
371
- color: 6,
372
- pv: {
373
- nodeType: 'server',
374
- shape: 'rectangle',
375
- icon: 'Server',
376
- },
377
- },
378
- {
379
- id: 'circle-icon',
380
- type: 'text',
381
- x: 300,
382
- y: 100,
383
- width: 100,
384
- height: 100,
385
- text: 'User',
386
- color: 5,
387
- pv: {
388
- nodeType: 'user',
389
- shape: 'circle',
390
- icon: 'User',
391
- },
392
- },
393
- {
394
- id: 'hex-icon',
395
- type: 'text',
396
- x: 480,
397
- y: 100,
398
- width: 140,
399
- height: 100,
400
- text: 'Database',
401
- color: 4,
402
- pv: {
403
- nodeType: 'database',
404
- shape: 'hexagon',
405
- icon: 'Database',
406
- },
407
- },
408
- {
409
- id: 'diamond-icon',
410
- type: 'text',
411
- x: 680,
412
- y: 100,
413
- width: 100,
414
- height: 100,
415
- text: 'Cache',
416
- color: 2,
417
- pv: {
418
- nodeType: 'cache',
419
- shape: 'diamond',
420
- icon: 'Zap',
421
- },
422
- },
423
- ],
424
- edges: [],
425
- pv: {
426
- version: '1.0.0',
427
- name: 'Shapes with Icons',
428
- description: 'Node shapes with Lucide icons',
429
- edgeTypes: {},
430
- },
431
- };
432
-
433
- export const ShapesWithIcons: Story = {
434
- args: {
435
- canvas: shapesWithIconsCanvas,
436
- width: 900,
437
- height: 300,
438
- },
439
- parameters: {
440
- docs: {
441
- description: {
442
- story: `
443
- **Shapes with Icons**
444
-
445
- Shows each shape with a Lucide icon to verify icon placement and sizing within different shapes.
446
- `,
447
- },
448
- },
449
- },
450
- };
451
-
452
- /**
453
- * Canvas showing shapes with states
454
- */
455
- const shapesWithStatesCanvas: ExtendedCanvas = {
456
- nodes: [
457
- // Idle state
458
- {
459
- id: 'rect-idle',
460
- type: 'text',
461
- x: 100,
462
- y: 80,
463
- width: 120,
464
- height: 70,
465
- text: 'Idle',
466
- color: 6,
467
- pv: {
468
- nodeType: 'process',
469
- shape: 'rectangle',
470
- icon: 'Box',
471
- states: {
472
- idle: { color: '#94a3b8', icon: 'Box' },
473
- active: { color: '#3b82f6', icon: 'Play' },
474
- error: { color: '#ef4444', icon: 'AlertCircle' },
475
- },
476
- },
477
- },
478
- {
479
- id: 'circle-idle',
480
- type: 'text',
481
- x: 280,
482
- y: 80,
483
- width: 90,
484
- height: 90,
485
- text: 'Idle',
486
- color: 5,
487
- pv: {
488
- nodeType: 'agent',
489
- shape: 'circle',
490
- icon: 'User',
491
- states: {
492
- idle: { color: '#94a3b8', icon: 'User' },
493
- active: { color: '#22c55e', icon: 'UserCheck' },
494
- error: { color: '#ef4444', icon: 'UserX' },
495
- },
496
- },
497
- },
498
- {
499
- id: 'hex-idle',
500
- type: 'text',
501
- x: 430,
502
- y: 80,
503
- width: 120,
504
- height: 90,
505
- text: 'Idle',
506
- color: 4,
507
- pv: {
508
- nodeType: 'storage',
509
- shape: 'hexagon',
510
- icon: 'Database',
511
- states: {
512
- idle: { color: '#94a3b8', icon: 'Database' },
513
- active: { color: '#22c55e', icon: 'HardDrive' },
514
- error: { color: '#ef4444', icon: 'Database' },
515
- },
516
- },
517
- },
518
- {
519
- id: 'diamond-idle',
520
- type: 'text',
521
- x: 600,
522
- y: 80,
523
- width: 90,
524
- height: 90,
525
- text: 'Idle',
526
- color: 2,
527
- pv: {
528
- nodeType: 'decision',
529
- shape: 'diamond',
530
- icon: 'GitBranch',
531
- states: {
532
- idle: { color: '#94a3b8', icon: 'GitBranch' },
533
- active: { color: '#f97316', icon: 'GitCommit' },
534
- error: { color: '#ef4444', icon: 'GitBranch' },
535
- },
536
- },
537
- },
538
-
539
- // Active state
540
- {
541
- id: 'rect-active',
542
- type: 'text',
543
- x: 100,
544
- y: 220,
545
- width: 120,
546
- height: 70,
547
- text: 'Active',
548
- color: 6,
549
- pv: {
550
- nodeType: 'process-active',
551
- shape: 'rectangle',
552
- icon: 'Play',
553
- color: '#3b82f6',
554
- },
555
- },
556
- {
557
- id: 'circle-active',
558
- type: 'text',
559
- x: 280,
560
- y: 220,
561
- width: 90,
562
- height: 90,
563
- text: 'Active',
564
- color: 5,
565
- pv: {
566
- nodeType: 'agent-active',
567
- shape: 'circle',
568
- icon: 'UserCheck',
569
- color: '#22c55e',
570
- },
571
- },
572
- {
573
- id: 'hex-active',
574
- type: 'text',
575
- x: 430,
576
- y: 220,
577
- width: 120,
578
- height: 90,
579
- text: 'Active',
580
- color: 4,
581
- pv: {
582
- nodeType: 'storage-active',
583
- shape: 'hexagon',
584
- icon: 'HardDrive',
585
- color: '#22c55e',
586
- },
587
- },
588
- {
589
- id: 'diamond-active',
590
- type: 'text',
591
- x: 600,
592
- y: 220,
593
- width: 90,
594
- height: 90,
595
- text: 'Active',
596
- color: 2,
597
- pv: {
598
- nodeType: 'decision-active',
599
- shape: 'diamond',
600
- icon: 'GitCommit',
601
- color: '#f97316',
602
- },
603
- },
604
-
605
- // Error state
606
- {
607
- id: 'rect-error',
608
- type: 'text',
609
- x: 100,
610
- y: 360,
611
- width: 120,
612
- height: 70,
613
- text: 'Error',
614
- color: 1,
615
- pv: {
616
- nodeType: 'process-error',
617
- shape: 'rectangle',
618
- icon: 'AlertCircle',
619
- color: '#ef4444',
620
- },
621
- },
622
- {
623
- id: 'circle-error',
624
- type: 'text',
625
- x: 280,
626
- y: 360,
627
- width: 90,
628
- height: 90,
629
- text: 'Error',
630
- color: 1,
631
- pv: {
632
- nodeType: 'agent-error',
633
- shape: 'circle',
634
- icon: 'UserX',
635
- color: '#ef4444',
636
- },
637
- },
638
- {
639
- id: 'hex-error',
640
- type: 'text',
641
- x: 430,
642
- y: 360,
643
- width: 120,
644
- height: 90,
645
- text: 'Error',
646
- color: 1,
647
- pv: {
648
- nodeType: 'storage-error',
649
- shape: 'hexagon',
650
- icon: 'Database',
651
- color: '#ef4444',
652
- },
653
- },
654
- {
655
- id: 'diamond-error',
656
- type: 'text',
657
- x: 600,
658
- y: 360,
659
- width: 90,
660
- height: 90,
661
- text: 'Error',
662
- color: 1,
663
- pv: {
664
- nodeType: 'decision-error',
665
- shape: 'diamond',
666
- icon: 'GitBranch',
667
- color: '#ef4444',
668
- },
669
- },
670
- ],
671
- edges: [],
672
- pv: {
673
- version: '1.0.0',
674
- name: 'Shapes with States',
675
- description: 'Node shapes in different states (idle, active, error)',
676
- edgeTypes: {},
677
- },
678
- };
679
-
680
- export const ShapesWithStates: Story = {
681
- args: {
682
- canvas: shapesWithStatesCanvas,
683
- width: 800,
684
- height: 550,
685
- },
686
- parameters: {
687
- docs: {
688
- description: {
689
- story: `
690
- **Shapes with States**
691
-
692
- Shows each shape in different visual states:
693
- - **Row 1**: Idle state (gray)
694
- - **Row 2**: Active state (blue/green/orange)
695
- - **Row 3**: Error state (red)
696
- `,
697
- },
698
- },
699
- },
700
- };
701
-
702
- /**
703
- * Interactive comparison of all shapes side by side
704
- */
705
- const ShapeComparisonTemplate = () => {
706
- return (
707
- <div style={{ padding: 20 }}>
708
- <h2 style={{ marginBottom: 20, fontFamily: 'system-ui' }}>Node Shape Comparison</h2>
709
-
710
- <div
711
- style={{
712
- display: 'grid',
713
- gridTemplateColumns: 'repeat(5, 1fr)',
714
- gap: 20,
715
- marginBottom: 30,
716
- }}
717
- >
718
- <div style={{ textAlign: 'center' }}>
719
- <h4 style={{ marginBottom: 10, fontFamily: 'system-ui' }}>Rectangle</h4>
720
- <code style={{ fontSize: 11 }}>shape: 'rectangle'</code>
721
- <div style={{ marginTop: 10, fontSize: 12, color: '#666' }}>borderRadius: 8px</div>
722
- </div>
723
- <div style={{ textAlign: 'center' }}>
724
- <h4 style={{ marginBottom: 10, fontFamily: 'system-ui' }}>Circle</h4>
725
- <code style={{ fontSize: 11 }}>shape: 'circle'</code>
726
- <div style={{ marginTop: 10, fontSize: 12, color: '#666' }}>borderRadius: 50%</div>
727
- </div>
728
- <div style={{ textAlign: 'center' }}>
729
- <h4 style={{ marginBottom: 10, fontFamily: 'system-ui' }}>Hexagon</h4>
730
- <code style={{ fontSize: 11 }}>shape: 'hexagon'</code>
731
- <div style={{ marginTop: 10, fontSize: 12, color: '#666' }}>CSS clip-path polygon</div>
732
- </div>
733
- <div style={{ textAlign: 'center' }}>
734
- <h4 style={{ marginBottom: 10, fontFamily: 'system-ui' }}>Diamond</h4>
735
- <code style={{ fontSize: 11 }}>shape: 'diamond'</code>
736
- <div style={{ marginTop: 10, fontSize: 12, color: '#666' }}>rotate(45deg)</div>
737
- </div>
738
- <div style={{ textAlign: 'center' }}>
739
- <h4 style={{ marginBottom: 10, fontFamily: 'system-ui' }}>Custom</h4>
740
- <code style={{ fontSize: 11 }}>shape: 'custom'</code>
741
- <div style={{ marginTop: 10, fontSize: 12, color: '#666' }}>Falls back to rectangle</div>
742
- </div>
743
- </div>
744
-
745
- <GraphRenderer canvas={allShapesCanvas} width={1100} height={280} />
746
-
747
- <div style={{ marginTop: 30, padding: 16, backgroundColor: '#f5f5f5', borderRadius: 8 }}>
748
- <h4 style={{ marginBottom: 10, fontFamily: 'system-ui' }}>Implementation Notes</h4>
749
- <ul style={{ fontSize: 13, lineHeight: 1.8, margin: 0, paddingLeft: 20 }}>
750
- <li>
751
- <strong>Rectangle</strong>: Standard box with 8px border radius
752
- </li>
753
- <li>
754
- <strong>Circle</strong>: Forces equal width/height, 50% border radius
755
- </li>
756
- <li>
757
- <strong>Hexagon</strong>: Flat-top style using{' '}
758
- <code>clipPath: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)</code>
759
- </li>
760
- <li>
761
- <strong>Diamond</strong>: Uses{' '}
762
- <code>clipPath: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)</code> - works with any
763
- aspect ratio
764
- </li>
765
- <li>
766
- <strong>Custom</strong>: Currently renders as rectangle (placeholder for future custom
767
- shapes)
768
- </li>
769
- </ul>
770
- </div>
771
- </div>
772
- );
773
- };
774
-
775
- export const ShapeComparison: Story = {
776
- render: () => <ShapeComparisonTemplate />,
777
- parameters: {
778
- docs: {
779
- description: {
780
- story: 'Interactive comparison view with implementation details for each shape.',
781
- },
782
- },
783
- },
784
- };
785
-
786
- /**
787
- * Canvas showing shapes with wide aspect ratios (width > height)
788
- */
789
- const wideShapesCanvas: ExtendedCanvas = {
790
- nodes: [
791
- {
792
- id: 'rect-wide',
793
- type: 'text',
794
- x: 50,
795
- y: 80,
796
- width: 280,
797
- height: 60,
798
- text: 'Wide Rectangle (280x60)',
799
- color: 6,
800
- pv: {
801
- nodeType: 'rect-wide',
802
- shape: 'rectangle',
803
- icon: 'RectangleHorizontal',
804
- },
805
- },
806
- {
807
- id: 'circle-wide',
808
- type: 'text',
809
- x: 380,
810
- y: 80,
811
- width: 280,
812
- height: 60,
813
- text: 'Wide Circle (280x60)',
814
- color: 5,
815
- pv: {
816
- nodeType: 'circle-wide',
817
- shape: 'circle',
818
- icon: 'Circle',
819
- },
820
- },
821
- {
822
- id: 'hex-wide',
823
- type: 'text',
824
- x: 50,
825
- y: 180,
826
- width: 280,
827
- height: 60,
828
- text: 'Wide Hexagon (280x60)',
829
- color: 4,
830
- pv: {
831
- nodeType: 'hex-wide',
832
- shape: 'hexagon',
833
- icon: 'Hexagon',
834
- },
835
- },
836
- {
837
- id: 'diamond-wide',
838
- type: 'text',
839
- x: 380,
840
- y: 180,
841
- width: 280,
842
- height: 60,
843
- text: 'Wide Diamond (280x60)',
844
- color: 2,
845
- pv: {
846
- nodeType: 'diamond-wide',
847
- shape: 'diamond',
848
- icon: 'Diamond',
849
- },
850
- },
851
- // Extra wide versions
852
- {
853
- id: 'rect-extra-wide',
854
- type: 'text',
855
- x: 50,
856
- y: 280,
857
- width: 400,
858
- height: 50,
859
- text: 'Extra Wide Rectangle (400x50)',
860
- color: 6,
861
- pv: {
862
- nodeType: 'rect-extra-wide',
863
- shape: 'rectangle',
864
- icon: 'RectangleHorizontal',
865
- },
866
- },
867
- {
868
- id: 'hex-extra-wide',
869
- type: 'text',
870
- x: 50,
871
- y: 360,
872
- width: 400,
873
- height: 50,
874
- text: 'Extra Wide Hexagon (400x50)',
875
- color: 4,
876
- pv: {
877
- nodeType: 'hex-extra-wide',
878
- shape: 'hexagon',
879
- icon: 'Hexagon',
880
- },
881
- },
882
- ],
883
- edges: [],
884
- pv: {
885
- version: '1.0.0',
886
- name: 'Wide Shapes Audit',
887
- description: 'Node shapes with wide aspect ratios',
888
- edgeTypes: {},
889
- },
890
- };
891
-
892
- export const WideShapes: Story = {
893
- args: {
894
- canvas: wideShapesCanvas,
895
- width: 750,
896
- height: 480,
897
- },
898
- parameters: {
899
- docs: {
900
- description: {
901
- story: `
902
- **Wide Aspect Ratio Shapes**
903
-
904
- Tests how each shape handles wide aspect ratios (width >> height):
905
- - **Row 1**: Wide shapes at 280x60
906
- - **Row 2**: Wide shapes at 280x60
907
- - **Row 3-4**: Extra wide shapes at 400x50
908
-
909
- Use this to audit:
910
- - How circle handles non-square dimensions (should it force square or stretch?)
911
- - How hexagon clip-path scales horizontally
912
- - How diamond rotation works with rectangular dimensions
913
- `,
914
- },
915
- },
916
- },
917
- };
918
-
919
- /**
920
- * Canvas showing shapes with tall aspect ratios (height > width)
921
- */
922
- const tallShapesCanvas: ExtendedCanvas = {
923
- nodes: [
924
- {
925
- id: 'rect-tall',
926
- type: 'text',
927
- x: 50,
928
- y: 50,
929
- width: 80,
930
- height: 200,
931
- text: 'Tall Rect',
932
- color: 6,
933
- pv: {
934
- nodeType: 'rect-tall',
935
- shape: 'rectangle',
936
- icon: 'RectangleVertical',
937
- },
938
- },
939
- {
940
- id: 'circle-tall',
941
- type: 'text',
942
- x: 180,
943
- y: 50,
944
- width: 80,
945
- height: 200,
946
- text: 'Tall Circle',
947
- color: 5,
948
- pv: {
949
- nodeType: 'circle-tall',
950
- shape: 'circle',
951
- icon: 'Circle',
952
- },
953
- },
954
- {
955
- id: 'hex-tall',
956
- type: 'text',
957
- x: 310,
958
- y: 50,
959
- width: 80,
960
- height: 200,
961
- text: 'Tall Hex',
962
- color: 4,
963
- pv: {
964
- nodeType: 'hex-tall',
965
- shape: 'hexagon',
966
- icon: 'Hexagon',
967
- },
968
- },
969
- {
970
- id: 'diamond-tall',
971
- type: 'text',
972
- x: 440,
973
- y: 50,
974
- width: 80,
975
- height: 200,
976
- text: 'Tall',
977
- color: 2,
978
- pv: {
979
- nodeType: 'diamond-tall',
980
- shape: 'diamond',
981
- icon: 'Diamond',
982
- },
983
- },
984
- // Extra tall versions
985
- {
986
- id: 'rect-extra-tall',
987
- type: 'text',
988
- x: 570,
989
- y: 50,
990
- width: 60,
991
- height: 280,
992
- text: 'Extra Tall',
993
- color: 6,
994
- pv: {
995
- nodeType: 'rect-extra-tall',
996
- shape: 'rectangle',
997
- icon: 'RectangleVertical',
998
- },
999
- },
1000
- {
1001
- id: 'hex-extra-tall',
1002
- type: 'text',
1003
- x: 680,
1004
- y: 50,
1005
- width: 60,
1006
- height: 280,
1007
- text: 'Extra Tall',
1008
- color: 4,
1009
- pv: {
1010
- nodeType: 'hex-extra-tall',
1011
- shape: 'hexagon',
1012
- icon: 'Hexagon',
1013
- },
1014
- },
1015
- ],
1016
- edges: [],
1017
- pv: {
1018
- version: '1.0.0',
1019
- name: 'Tall Shapes Audit',
1020
- description: 'Node shapes with tall aspect ratios',
1021
- edgeTypes: {},
1022
- },
1023
- };
1024
-
1025
- export const TallShapes: Story = {
1026
- args: {
1027
- canvas: tallShapesCanvas,
1028
- width: 800,
1029
- height: 400,
1030
- },
1031
- parameters: {
1032
- docs: {
1033
- description: {
1034
- story: `
1035
- **Tall Aspect Ratio Shapes**
1036
-
1037
- Tests how each shape handles tall aspect ratios (height >> width):
1038
- - **Columns 1-4**: Tall shapes at 80x200
1039
- - **Columns 5-6**: Extra tall shapes at 60x280
1040
-
1041
- Use this to audit:
1042
- - How circle handles non-square dimensions
1043
- - How hexagon clip-path scales vertically
1044
- - How diamond rotation works with tall rectangular dimensions
1045
- - Text/icon placement in narrow vertical spaces
1046
- `,
1047
- },
1048
- },
1049
- },
1050
- };
1051
-
1052
- /**
1053
- * Canvas showing extreme aspect ratios for stress testing
1054
- */
1055
- const extremeAspectRatiosCanvas: ExtendedCanvas = {
1056
- nodes: [
1057
- // Very wide row
1058
- {
1059
- id: 'rect-very-wide',
1060
- type: 'text',
1061
- x: 50,
1062
- y: 50,
1063
- width: 500,
1064
- height: 40,
1065
- text: 'Very Wide Rectangle (500x40) - Testing extreme horizontal stretch',
1066
- color: 6,
1067
- pv: {
1068
- nodeType: 'rect-very-wide',
1069
- shape: 'rectangle',
1070
- },
1071
- },
1072
- {
1073
- id: 'hex-very-wide',
1074
- type: 'text',
1075
- x: 50,
1076
- y: 120,
1077
- width: 500,
1078
- height: 40,
1079
- text: 'Very Wide Hexagon (500x40) - Testing clip-path at extremes',
1080
- color: 4,
1081
- pv: {
1082
- nodeType: 'hex-very-wide',
1083
- shape: 'hexagon',
1084
- },
1085
- },
1086
- // Very tall column
1087
- {
1088
- id: 'rect-very-tall',
1089
- type: 'text',
1090
- x: 600,
1091
- y: 50,
1092
- width: 50,
1093
- height: 300,
1094
- text: 'Very Tall',
1095
- color: 6,
1096
- pv: {
1097
- nodeType: 'rect-very-tall',
1098
- shape: 'rectangle',
1099
- },
1100
- },
1101
- {
1102
- id: 'hex-very-tall',
1103
- type: 'text',
1104
- x: 700,
1105
- y: 50,
1106
- width: 50,
1107
- height: 300,
1108
- text: 'Very Tall',
1109
- color: 4,
1110
- pv: {
1111
- nodeType: 'hex-very-tall',
1112
- shape: 'hexagon',
1113
- },
1114
- },
1115
- // Circle and diamond with extreme ratios (should these enforce square?)
1116
- {
1117
- id: 'circle-extreme-wide',
1118
- type: 'text',
1119
- x: 50,
1120
- y: 200,
1121
- width: 200,
1122
- height: 40,
1123
- text: 'Circle Wide?',
1124
- color: 5,
1125
- pv: {
1126
- nodeType: 'circle-extreme-wide',
1127
- shape: 'circle',
1128
- },
1129
- },
1130
- {
1131
- id: 'diamond-extreme-wide',
1132
- type: 'text',
1133
- x: 300,
1134
- y: 200,
1135
- width: 200,
1136
- height: 40,
1137
- text: 'Diamond Wide?',
1138
- color: 2,
1139
- pv: {
1140
- nodeType: 'diamond-extreme-wide',
1141
- shape: 'diamond',
1142
- },
1143
- },
1144
- {
1145
- id: 'circle-extreme-tall',
1146
- type: 'text',
1147
- x: 50,
1148
- y: 280,
1149
- width: 50,
1150
- height: 120,
1151
- text: 'Tall?',
1152
- color: 5,
1153
- pv: {
1154
- nodeType: 'circle-extreme-tall',
1155
- shape: 'circle',
1156
- },
1157
- },
1158
- {
1159
- id: 'diamond-extreme-tall',
1160
- type: 'text',
1161
- x: 150,
1162
- y: 280,
1163
- width: 50,
1164
- height: 120,
1165
- text: 'Tall?',
1166
- color: 2,
1167
- pv: {
1168
- nodeType: 'diamond-extreme-tall',
1169
- shape: 'diamond',
1170
- },
1171
- },
1172
- ],
1173
- edges: [],
1174
- pv: {
1175
- version: '1.0.0',
1176
- name: 'Extreme Aspect Ratios',
1177
- description: 'Stress testing node shapes with extreme dimensions',
1178
- edgeTypes: {},
1179
- },
1180
- };
1181
-
1182
- export const ExtremeAspectRatios: Story = {
1183
- args: {
1184
- canvas: extremeAspectRatiosCanvas,
1185
- width: 800,
1186
- height: 450,
1187
- },
1188
- parameters: {
1189
- docs: {
1190
- description: {
1191
- story: `
1192
- **Extreme Aspect Ratios (Stress Test)**
1193
-
1194
- Tests shapes at extreme aspect ratios to identify edge cases:
1195
- - **500x40**: Very wide shapes
1196
- - **50x300**: Very tall shapes
1197
- - Circle with non-square dimensions (should it enforce square or stretch?)
1198
-
1199
- Key questions to answer:
1200
- 1. Does circle force equal width/height or stretch?
1201
- 2. Does hexagon clip-path degrade gracefully at extremes?
1202
- 3. Does diamond clip-path work correctly at extremes?
1203
- 4. Is text readable in narrow/short shapes?
1204
- `,
1205
- },
1206
- },
1207
- },
1208
- };