@principal-ai/principal-view-react 0.14.36 → 0.14.38

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 (29) hide show
  1. package/dist/nodes/CustomNode.d.ts.map +1 -1
  2. package/dist/nodes/CustomNode.js +3 -25
  3. package/dist/nodes/CustomNode.js.map +1 -1
  4. package/dist/nodes/otel/OtelBoundaryNode.d.ts.map +1 -1
  5. package/dist/nodes/otel/OtelBoundaryNode.js +1 -12
  6. package/dist/nodes/otel/OtelBoundaryNode.js.map +1 -1
  7. package/dist/nodes/otel/OtelEventNode.d.ts.map +1 -1
  8. package/dist/nodes/otel/OtelEventNode.js +1 -12
  9. package/dist/nodes/otel/OtelEventNode.js.map +1 -1
  10. package/dist/nodes/otel/OtelResourceNode.d.ts.map +1 -1
  11. package/dist/nodes/otel/OtelResourceNode.js +1 -12
  12. package/dist/nodes/otel/OtelResourceNode.js.map +1 -1
  13. package/dist/nodes/otel/OtelScopeNode.d.ts +1 -1
  14. package/dist/nodes/otel/OtelScopeNode.d.ts.map +1 -1
  15. package/dist/nodes/otel/OtelScopeNode.js +3 -14
  16. package/dist/nodes/otel/OtelScopeNode.js.map +1 -1
  17. package/dist/nodes/otel/OtelSpanConventionNode.d.ts.map +1 -1
  18. package/dist/nodes/otel/OtelSpanConventionNode.js +1 -15
  19. package/dist/nodes/otel/OtelSpanConventionNode.js.map +1 -1
  20. package/package.json +3 -3
  21. package/src/nodes/CustomNode.tsx +0 -26
  22. package/src/nodes/otel/OtelBoundaryNode.tsx +1 -13
  23. package/src/nodes/otel/OtelEventNode.tsx +0 -12
  24. package/src/nodes/otel/OtelResourceNode.tsx +1 -13
  25. package/src/nodes/otel/OtelScopeNode.tsx +5 -17
  26. package/src/nodes/otel/OtelSpanConventionNode.tsx +1 -16
  27. package/src/stories/BacklogMdCanvases.stories.tsx +721 -0
  28. package/src/stories/OtelNodeTypesPrototype.stories.tsx +1 -1
  29. package/src/stories/ValidationEventsCanvas.stories.tsx +2 -2
@@ -0,0 +1,721 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import '@xyflow/react/dist/style.css';
4
+ import { GraphRenderer } from '../components/GraphRenderer';
5
+ import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
6
+ import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
7
+
8
+ // Import canvas files from Backlog.md repository
9
+ // Architecture canvases
10
+ import scopesCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/architecture.scopes.canvas?url';
11
+ import spansCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/architecture.spans.canvas?url';
12
+
13
+ // Event namespace canvas
14
+ import eventsCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/backlog-md.events.canvas?url';
15
+
16
+ // OTEL workflow canvases
17
+ import initOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/init/init.otel.canvas?url';
18
+ import taskManagementOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/task-management/task-management.otel.canvas?url';
19
+ import decisionManagementOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/decision-management/decision-management.otel.canvas?url';
20
+ import cleanupOperationsOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/cleanup-operations/cleanup-operations.otel.canvas?url';
21
+ import milestoneManagementOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/milestone-management/milestone-management.otel.canvas?url';
22
+ import draftManagementOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/draft-management/draft-management.otel.canvas?url';
23
+ import documentManagementOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/document-management/document-management.otel.canvas?url';
24
+ import entryPointsOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/entry-points/entry-points.otel.canvas?url';
25
+ import searchOperationsOtelCanvasUrl from '/Users/griever/Developer/backlog-adaptation/Backlog.md/.principal-views/search-operations/search-operations.otel.canvas?url';
26
+
27
+ // Helper to load canvas from URL
28
+ async function loadCanvas(url: string): Promise<ExtendedCanvas> {
29
+ const response = await fetch(url);
30
+ return await response.json();
31
+ }
32
+
33
+ // Wrapper component that loads canvas data
34
+ function CanvasLoader({
35
+ url,
36
+ children,
37
+ showBackground = false,
38
+ editable = true
39
+ }: {
40
+ url: string;
41
+ children: (canvas: ExtendedCanvas) => React.ReactNode;
42
+ showBackground?: boolean;
43
+ editable?: boolean;
44
+ }) {
45
+ const [canvas, setCanvas] = useState<ExtendedCanvas | null>(null);
46
+ const [error, setError] = useState<string | null>(null);
47
+
48
+ useEffect(() => {
49
+ loadCanvas(url)
50
+ .then(setCanvas)
51
+ .catch((err) => setError(err.message));
52
+ }, [url]);
53
+
54
+ if (error) {
55
+ return <div style={{ padding: 20, color: 'red' }}>Error loading canvas: {error}</div>;
56
+ }
57
+
58
+ if (!canvas) {
59
+ return <div style={{ padding: 20 }}>Loading canvas...</div>;
60
+ }
61
+
62
+ return (
63
+ <div style={{ width: '100%', height: '100vh' }}>
64
+ {children(canvas)}
65
+ </div>
66
+ );
67
+ }
68
+
69
+ const meta = {
70
+ title: 'Real Projects/Backlog.md Canvases',
71
+ component: GraphRenderer,
72
+ parameters: {
73
+ layout: 'fullscreen',
74
+ },
75
+ tags: ['autodocs'],
76
+ decorators: [
77
+ (Story) => (
78
+ <ThemeProvider theme={defaultEditorTheme}>
79
+ <div style={{ width: '100vw', height: '100vh' }}>
80
+ <Story />
81
+ </div>
82
+ </ThemeProvider>
83
+ ),
84
+ ],
85
+ } satisfies Meta<typeof GraphRenderer>;
86
+
87
+ export default meta;
88
+ type Story = StoryObj<typeof meta>;
89
+
90
+ // ============================================================================
91
+ // Architecture Canvas Files
92
+ // ============================================================================
93
+
94
+ /**
95
+ * Architecture Scopes Canvas
96
+ *
97
+ * File: architecture.scopes.canvas
98
+ * Type: otel-scope nodes
99
+ * Purpose: Documents instrumentation scopes for the Backlog.md system
100
+ */
101
+ export const ArchitectureScopes: Story = {
102
+ render: () => (
103
+ <CanvasLoader url={scopesCanvasUrl}>
104
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
105
+ </CanvasLoader>
106
+ ),
107
+ parameters: {
108
+ docs: {
109
+ description: {
110
+ story: `
111
+ Renders the **architecture.scopes.canvas** from the Backlog.md repository.
112
+
113
+ This canvas shows the instrumentation architecture with:
114
+ - **CLI Scope** - Command-line interface operations
115
+ - **MCP Server Scope** - Model Context Protocol server integration
116
+ - **HTTP Server Scope** - REST API server (draft)
117
+ - **Terminal UI Scope** - Interactive terminal interface (draft)
118
+ - **Web UI Scope** - React-based browser interface (draft)
119
+ - **Backlog.md Core Scope** - Core library for task management
120
+
121
+ **Node Type:** \`otel-scope\`
122
+ **Visual Style:** Rectangle nodes with scope colors
123
+ **Status:** Shows implementation status (implemented/draft)
124
+
125
+ **Use this to:**
126
+ - Preview scope architecture visualization
127
+ - Verify scope node rendering with status badges
128
+ - Test edge relationships between scopes
129
+ `,
130
+ },
131
+ },
132
+ },
133
+ };
134
+
135
+ /**
136
+ * Architecture Spans Canvas
137
+ *
138
+ * File: architecture.spans.canvas
139
+ * Type: otel-span-convention nodes
140
+ * Purpose: Defines span naming conventions and valid parent-child relationships
141
+ */
142
+ export const ArchitectureSpans: Story = {
143
+ render: () => (
144
+ <CanvasLoader url={spansCanvasUrl}>
145
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
146
+ </CanvasLoader>
147
+ ),
148
+ parameters: {
149
+ docs: {
150
+ description: {
151
+ story: `
152
+ Renders the **architecture.spans.canvas** from the Backlog.md repository.
153
+
154
+ This canvas documents span naming conventions for user-level workflows:
155
+ - Task management operations (create, edit, view, list, complete, archive)
156
+ - Milestone operations
157
+ - Draft operations
158
+ - Document operations
159
+ - Decision operations
160
+ - Search operations
161
+
162
+ **Node Type:** \`otel-span-convention\`
163
+ **Visual Style:** Hexagon nodes with span patterns
164
+ **Metadata:** Includes span kind, parent patterns, and workflow chips
165
+
166
+ **Use this to:**
167
+ - Preview span convention documentation
168
+ - Verify hexagon shape rendering for span conventions
169
+ - Test workflow chip display
170
+ `,
171
+ },
172
+ },
173
+ },
174
+ };
175
+
176
+ // ============================================================================
177
+ // Event Namespace Canvas
178
+ // ============================================================================
179
+
180
+ /**
181
+ * Event Namespace Canvas
182
+ *
183
+ * File: backlog-md.events.canvas
184
+ * Type: otel-event nodes
185
+ * Purpose: Shows the vocabulary of events emitted by the system
186
+ */
187
+ export const EventNamespace: Story = {
188
+ render: () => (
189
+ <CanvasLoader url={eventsCanvasUrl}>
190
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} editable={true} />}
191
+ </CanvasLoader>
192
+ ),
193
+ parameters: {
194
+ docs: {
195
+ description: {
196
+ story: `
197
+ Renders the **backlog-md.events.canvas** from the Backlog.md repository.
198
+
199
+ This canvas shows core system events:
200
+ - **Task Events** - task.created, task.updated, task.completed
201
+ - **Document Events** - document.created
202
+ - **Search Events** - search.executed
203
+
204
+ **Node Type:** \`otel-event\`
205
+ **Visual Style:** Rectangle nodes with event colors
206
+ **Metadata:** Event attributes schema with type and required fields
207
+
208
+ **Event Attributes:**
209
+ Each event node documents its attribute schema:
210
+ - Attribute names and types
211
+ - Required vs optional fields
212
+ - Implementation status and scope
213
+
214
+ **Use this to:**
215
+ - Preview event vocabulary documentation
216
+ - Verify event node rendering with attributes
217
+ - Test event schema tooltips
218
+ `,
219
+ },
220
+ },
221
+ },
222
+ };
223
+
224
+ // ============================================================================
225
+ // OTEL Workflow Canvas Files
226
+ // ============================================================================
227
+
228
+ /**
229
+ * Init Workflow Canvas
230
+ *
231
+ * File: init/init.otel.canvas
232
+ * Type: otel-event nodes (workflow)
233
+ * Purpose: Documents the initialization workflow for Backlog.md
234
+ */
235
+ export const InitWorkflow: Story = {
236
+ render: () => (
237
+ <CanvasLoader url={initOtelCanvasUrl}>
238
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
239
+ </CanvasLoader>
240
+ ),
241
+ parameters: {
242
+ docs: {
243
+ description: {
244
+ story: `
245
+ Renders the **init/init.otel.canvas** workflow from the Backlog.md repository.
246
+
247
+ This canvas shows the initialization workflow events for setting up a new Backlog.md repository.
248
+
249
+ **Use this to:**
250
+ - Preview workflow event sequences
251
+ - Test event-to-event flow visualization
252
+ - Verify implementation status badges
253
+ `,
254
+ },
255
+ },
256
+ },
257
+ };
258
+
259
+ /**
260
+ * Task Management Workflow Canvas
261
+ *
262
+ * File: task-management/task-management.otel.canvas
263
+ * Type: otel-event nodes (workflow)
264
+ * Purpose: Comprehensive task management operations
265
+ */
266
+ export const TaskManagementWorkflow: Story = {
267
+ render: () => (
268
+ <CanvasLoader url={taskManagementOtelCanvasUrl}>
269
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
270
+ </CanvasLoader>
271
+ ),
272
+ parameters: {
273
+ docs: {
274
+ description: {
275
+ story: `
276
+ Renders the **task-management/task-management.otel.canvas** workflow.
277
+
278
+ This canvas shows comprehensive task management workflows including:
279
+ - **Create Task** - Started → Validated → Saved → Committed → Complete
280
+ - **Edit Task** - Started → Loaded → Validated → Updated → Committed → Complete
281
+ - **View Task** - Started → Loaded → Complete
282
+ - **List Tasks** - Started → Loaded → Filtered → Complete
283
+ - **Demote Task** - Started → Loaded → Moved → Committed → Complete
284
+ - **Archive Task** - Started → Located → Moved → Committed → Complete
285
+ - **Complete Task** - Started → Located → Moved → Committed → Complete
286
+ - **Error Handling** - Error paths from all workflows
287
+
288
+ **Node Type:** \`otel-event\`
289
+ **Visual Style:** Sequential flow with color-coded event phases
290
+ - Green: Start/Complete events
291
+ - Blue: Processing events
292
+ - Orange: Commit events
293
+ - Red: Error events
294
+
295
+ **Edge Types:**
296
+ - **flow** - Normal workflow progression (solid lines)
297
+ - **error** - Error paths (dashed red lines)
298
+
299
+ **Use this to:**
300
+ - Preview complex multi-workflow canvases
301
+ - Test event sequence rendering
302
+ - Verify error path visualization
303
+ - Demonstrate real-world workflow complexity
304
+ `,
305
+ },
306
+ },
307
+ },
308
+ };
309
+
310
+ /**
311
+ * Decision Management Workflow Canvas
312
+ *
313
+ * File: decision-management/decision-management.otel.canvas
314
+ * Type: otel-event nodes (workflow)
315
+ * Purpose: Decision tracking and management operations
316
+ */
317
+ export const DecisionManagementWorkflow: Story = {
318
+ render: () => (
319
+ <CanvasLoader url={decisionManagementOtelCanvasUrl}>
320
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
321
+ </CanvasLoader>
322
+ ),
323
+ parameters: {
324
+ docs: {
325
+ description: {
326
+ story: `
327
+ Renders the **decision-management/decision-management.otel.canvas** workflow.
328
+
329
+ This canvas shows decision management workflows for tracking architectural and project decisions.
330
+
331
+ **Use this to:**
332
+ - Preview decision tracking workflows
333
+ - Test workflow event rendering variations
334
+ `,
335
+ },
336
+ },
337
+ },
338
+ };
339
+
340
+ /**
341
+ * Cleanup Operations Workflow Canvas
342
+ *
343
+ * File: cleanup-operations/cleanup-operations.otel.canvas
344
+ * Type: otel-event nodes (workflow)
345
+ * Purpose: Batch cleanup and maintenance operations
346
+ */
347
+ export const CleanupOperationsWorkflow: Story = {
348
+ render: () => (
349
+ <CanvasLoader url={cleanupOperationsOtelCanvasUrl}>
350
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
351
+ </CanvasLoader>
352
+ ),
353
+ parameters: {
354
+ docs: {
355
+ description: {
356
+ story: `
357
+ Renders the **cleanup-operations/cleanup-operations.otel.canvas** workflow.
358
+
359
+ This canvas shows cleanup and maintenance workflows for batch operations.
360
+
361
+ **Use this to:**
362
+ - Preview batch operation workflows
363
+ - Test cleanup event visualization
364
+ `,
365
+ },
366
+ },
367
+ },
368
+ };
369
+
370
+ /**
371
+ * Milestone Management Workflow Canvas
372
+ *
373
+ * File: milestone-management/milestone-management.otel.canvas
374
+ * Type: otel-event nodes (workflow)
375
+ * Purpose: Milestone tracking and management operations
376
+ */
377
+ export const MilestoneManagementWorkflow: Story = {
378
+ render: () => (
379
+ <CanvasLoader url={milestoneManagementOtelCanvasUrl}>
380
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
381
+ </CanvasLoader>
382
+ ),
383
+ parameters: {
384
+ docs: {
385
+ description: {
386
+ story: `
387
+ Renders the **milestone-management/milestone-management.otel.canvas** workflow.
388
+
389
+ This canvas shows milestone management workflows for project planning.
390
+
391
+ **Use this to:**
392
+ - Preview milestone workflow visualization
393
+ - Test milestone event rendering
394
+ `,
395
+ },
396
+ },
397
+ },
398
+ };
399
+
400
+ /**
401
+ * Draft Management Workflow Canvas
402
+ *
403
+ * File: draft-management/draft-management.otel.canvas
404
+ * Type: otel-event nodes (workflow)
405
+ * Purpose: Draft document management and promotion operations
406
+ */
407
+ export const DraftManagementWorkflow: Story = {
408
+ render: () => (
409
+ <CanvasLoader url={draftManagementOtelCanvasUrl}>
410
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
411
+ </CanvasLoader>
412
+ ),
413
+ parameters: {
414
+ docs: {
415
+ description: {
416
+ story: `
417
+ Renders the **draft-management/draft-management.otel.canvas** workflow.
418
+
419
+ This canvas shows draft management workflows including draft creation, promotion, and filesystem operations.
420
+
421
+ **Use this to:**
422
+ - Preview draft workflow visualization
423
+ - Test draft promotion event flows
424
+ `,
425
+ },
426
+ },
427
+ },
428
+ };
429
+
430
+ /**
431
+ * Document Management Workflow Canvas
432
+ *
433
+ * File: document-management/document-management.otel.canvas
434
+ * Type: otel-event nodes (workflow)
435
+ * Purpose: Document CRUD operations
436
+ */
437
+ export const DocumentManagementWorkflow: Story = {
438
+ render: () => (
439
+ <CanvasLoader url={documentManagementOtelCanvasUrl}>
440
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
441
+ </CanvasLoader>
442
+ ),
443
+ parameters: {
444
+ docs: {
445
+ description: {
446
+ story: `
447
+ Renders the **document-management/document-management.otel.canvas** workflow.
448
+
449
+ This canvas shows document management workflows for creating, viewing, updating, and searching documents.
450
+
451
+ **Use this to:**
452
+ - Preview document workflow visualization
453
+ - Test document CRUD event flows
454
+ `,
455
+ },
456
+ },
457
+ },
458
+ };
459
+
460
+ /**
461
+ * Entry Points Workflow Canvas
462
+ *
463
+ * File: entry-points/entry-points.otel.canvas
464
+ * Type: otel-event nodes (workflow)
465
+ * Purpose: System entry point operations (CLI, MCP, HTTP)
466
+ */
467
+ export const EntryPointsWorkflow: Story = {
468
+ render: () => (
469
+ <CanvasLoader url={entryPointsOtelCanvasUrl}>
470
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
471
+ </CanvasLoader>
472
+ ),
473
+ parameters: {
474
+ docs: {
475
+ description: {
476
+ story: `
477
+ Renders the **entry-points/entry-points.otel.canvas** workflow.
478
+
479
+ This canvas shows entry point workflows for different interfaces:
480
+ - CLI requests
481
+ - MCP tool invocations
482
+ - HTTP requests
483
+ - Completed tasks list
484
+
485
+ **Use this to:**
486
+ - Preview multi-interface entry point visualization
487
+ - Test entry point event flows
488
+ `,
489
+ },
490
+ },
491
+ },
492
+ };
493
+
494
+ /**
495
+ * Search Operations Workflow Canvas
496
+ *
497
+ * File: search-operations/search-operations.otel.canvas
498
+ * Type: otel-event nodes (workflow)
499
+ * Purpose: Search and indexing operations
500
+ */
501
+ export const SearchOperationsWorkflow: Story = {
502
+ render: () => (
503
+ <CanvasLoader url={searchOperationsOtelCanvasUrl}>
504
+ {(canvas) => <GraphRenderer canvas={canvas} showBackground={false} />}
505
+ </CanvasLoader>
506
+ ),
507
+ parameters: {
508
+ docs: {
509
+ description: {
510
+ story: `
511
+ Renders the **search-operations/search-operations.otel.canvas** workflow.
512
+
513
+ This canvas shows search and indexing workflows for content discovery.
514
+
515
+ **Use this to:**
516
+ - Preview search workflow visualization
517
+ - Test search event flows
518
+ `,
519
+ },
520
+ },
521
+ },
522
+ };
523
+
524
+ // ============================================================================
525
+ // Combined Views
526
+ // ============================================================================
527
+
528
+ /**
529
+ * All Canvas Types - Grid View
530
+ *
531
+ * Shows all canvas types in a grid layout for comparison
532
+ */
533
+ export const AllCanvasTypesGrid: Story = {
534
+ render: () => {
535
+ const [canvases, setCanvases] = useState<{
536
+ scopes?: ExtendedCanvas;
537
+ spans?: ExtendedCanvas;
538
+ events?: ExtendedCanvas;
539
+ taskManagement?: ExtendedCanvas;
540
+ init?: ExtendedCanvas;
541
+ }>({});
542
+
543
+ useEffect(() => {
544
+ Promise.all([
545
+ loadCanvas(scopesCanvasUrl),
546
+ loadCanvas(spansCanvasUrl),
547
+ loadCanvas(eventsCanvasUrl),
548
+ loadCanvas(taskManagementOtelCanvasUrl),
549
+ loadCanvas(initOtelCanvasUrl),
550
+ ]).then(([scopes, spans, events, taskManagement, init]) => {
551
+ setCanvases({ scopes, spans, events, taskManagement, init });
552
+ });
553
+ }, []);
554
+
555
+ if (!canvases.scopes) {
556
+ return <div style={{ padding: 20 }}>Loading all canvases...</div>;
557
+ }
558
+
559
+ return (
560
+ <div style={{
561
+ display: 'grid',
562
+ gridTemplateColumns: '1fr 1fr',
563
+ gap: '20px',
564
+ padding: '20px',
565
+ height: '100vh',
566
+ overflow: 'auto'
567
+ }}>
568
+ <div>
569
+ <h3 style={{ marginTop: 0, fontSize: '16px', marginBottom: '10px' }}>Architecture Scopes</h3>
570
+ <div style={{ height: '300px', border: '1px solid #ccc', borderRadius: '4px' }}>
571
+ <GraphRenderer canvas={canvases.scopes} showBackground={false} />
572
+ </div>
573
+ </div>
574
+ <div>
575
+ <h3 style={{ marginTop: 0, fontSize: '16px', marginBottom: '10px' }}>Architecture Spans</h3>
576
+ <div style={{ height: '300px', border: '1px solid #ccc', borderRadius: '4px' }}>
577
+ {canvases.spans && <GraphRenderer canvas={canvases.spans} showBackground={false} />}
578
+ </div>
579
+ </div>
580
+ <div>
581
+ <h3 style={{ marginTop: 0, fontSize: '16px', marginBottom: '10px' }}>Event Namespace</h3>
582
+ <div style={{ height: '300px', border: '1px solid #ccc', borderRadius: '4px' }}>
583
+ {canvases.events && <GraphRenderer canvas={canvases.events} showBackground={false} />}
584
+ </div>
585
+ </div>
586
+ <div>
587
+ <h3 style={{ marginTop: 0, fontSize: '16px', marginBottom: '10px' }}>Init Workflow</h3>
588
+ <div style={{ height: '300px', border: '1px solid #ccc', borderRadius: '4px' }}>
589
+ {canvases.init && <GraphRenderer canvas={canvases.init} showBackground={false} />}
590
+ </div>
591
+ </div>
592
+ <div style={{ gridColumn: '1 / -1' }}>
593
+ <h3 style={{ marginTop: 0, fontSize: '16px', marginBottom: '10px' }}>Task Management Workflow</h3>
594
+ <div style={{ height: '500px', border: '1px solid #ccc', borderRadius: '4px' }}>
595
+ {canvases.taskManagement && <GraphRenderer canvas={canvases.taskManagement} showBackground={false} />}
596
+ </div>
597
+ </div>
598
+ </div>
599
+ );
600
+ },
601
+ parameters: {
602
+ docs: {
603
+ description: {
604
+ story: `
605
+ Shows multiple canvas types from the Backlog.md repository in a grid layout.
606
+
607
+ This view helps:
608
+ - Compare visual styling across different canvas types
609
+ - Test layout consistency
610
+ - Verify theme application across all canvas variations
611
+ - Spot visual regressions quickly
612
+ - Demonstrate the complete range of canvas file formats
613
+
614
+ **Canvas Types Shown:**
615
+ 1. **Architecture Scopes** - System component scopes
616
+ 2. **Architecture Spans** - Span naming conventions
617
+ 3. **Event Namespace** - Event vocabulary
618
+ 4. **Init Workflow** - Initialization events
619
+ 5. **Task Management Workflow** - Complete task workflow (largest example)
620
+ `,
621
+ },
622
+ },
623
+ },
624
+ };
625
+
626
+ /**
627
+ * All Workflow Canvases - Tabbed View
628
+ *
629
+ * Shows all workflow canvases with a selector
630
+ */
631
+ export const AllWorkflowCanvases: Story = {
632
+ render: () => {
633
+ const [selectedWorkflow, setSelectedWorkflow] = useState<string>('task-management');
634
+ const [canvas, setCanvas] = useState<ExtendedCanvas | null>(null);
635
+
636
+ const workflows = {
637
+ 'init': { url: initOtelCanvasUrl, title: 'Init Workflow' },
638
+ 'task-management': { url: taskManagementOtelCanvasUrl, title: 'Task Management' },
639
+ 'decision-management': { url: decisionManagementOtelCanvasUrl, title: 'Decision Management' },
640
+ 'cleanup-operations': { url: cleanupOperationsOtelCanvasUrl, title: 'Cleanup Operations' },
641
+ 'milestone-management': { url: milestoneManagementOtelCanvasUrl, title: 'Milestone Management' },
642
+ 'draft-management': { url: draftManagementOtelCanvasUrl, title: 'Draft Management' },
643
+ 'document-management': { url: documentManagementOtelCanvasUrl, title: 'Document Management' },
644
+ 'entry-points': { url: entryPointsOtelCanvasUrl, title: 'Entry Points' },
645
+ 'search-operations': { url: searchOperationsOtelCanvasUrl, title: 'Search Operations' },
646
+ };
647
+
648
+ useEffect(() => {
649
+ const workflow = workflows[selectedWorkflow as keyof typeof workflows];
650
+ if (workflow) {
651
+ loadCanvas(workflow.url).then(setCanvas);
652
+ }
653
+ }, [selectedWorkflow]);
654
+
655
+ return (
656
+ <div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
657
+ <div style={{
658
+ padding: '20px',
659
+ borderBottom: '1px solid #ccc',
660
+ display: 'flex',
661
+ gap: '10px',
662
+ flexWrap: 'wrap',
663
+ backgroundColor: '#f5f5f5'
664
+ }}>
665
+ <label style={{ fontWeight: 'bold', marginRight: '10px' }}>Select Workflow:</label>
666
+ {Object.entries(workflows).map(([key, { title }]) => (
667
+ <button
668
+ key={key}
669
+ onClick={() => setSelectedWorkflow(key)}
670
+ style={{
671
+ padding: '8px 16px',
672
+ backgroundColor: selectedWorkflow === key ? '#3b82f6' : '#fff',
673
+ color: selectedWorkflow === key ? '#fff' : '#000',
674
+ border: '1px solid #ccc',
675
+ borderRadius: '4px',
676
+ cursor: 'pointer',
677
+ fontSize: '14px',
678
+ fontWeight: selectedWorkflow === key ? 'bold' : 'normal',
679
+ }}
680
+ >
681
+ {title}
682
+ </button>
683
+ ))}
684
+ </div>
685
+ <div style={{ flex: 1, position: 'relative' }}>
686
+ {canvas ? (
687
+ <GraphRenderer canvas={canvas} showBackground={false} />
688
+ ) : (
689
+ <div style={{ padding: 20 }}>Loading canvas...</div>
690
+ )}
691
+ </div>
692
+ </div>
693
+ );
694
+ },
695
+ parameters: {
696
+ docs: {
697
+ description: {
698
+ story: `
699
+ Interactive view showing all workflow canvases with a selector.
700
+
701
+ This view helps:
702
+ - Browse through all workflow variations
703
+ - Compare workflow complexity
704
+ - Test workflow canvas rendering across different domains
705
+ - Demonstrate the versatility of the .otel.canvas format
706
+
707
+ **Available Workflows:**
708
+ - **Init** - Repository initialization
709
+ - **Task Management** - Complete task lifecycle (most complex)
710
+ - **Decision Management** - Decision tracking
711
+ - **Cleanup Operations** - Batch cleanup
712
+ - **Milestone Management** - Project milestones
713
+ - **Draft Management** - Draft promotion
714
+ - **Document Management** - Document CRUD
715
+ - **Entry Points** - System interfaces
716
+ - **Search Operations** - Search and indexing
717
+ `,
718
+ },
719
+ },
720
+ },
721
+ };