@principal-ai/principal-view-react 0.15.6 → 0.15.8

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.
@@ -161,7 +161,6 @@ export const CacheHitFlow: Story = {
161
161
  edges={workflowData.workflows[0].edges}
162
162
  height={600}
163
163
  layoutOptions={{
164
- namespaceStrategy: 'first',
165
164
  laneWidth: 200,
166
165
  eventSpacing: 80,
167
166
  }}
@@ -204,7 +203,6 @@ export const GenerateNewFlow: Story = {
204
203
  edges={workflowData.workflows[1].edges}
205
204
  height={700}
206
205
  layoutOptions={{
207
- namespaceStrategy: 'first',
208
206
  laneWidth: 200,
209
207
  eventSpacing: 80,
210
208
  }}
@@ -242,7 +240,6 @@ export const NoFileTreeFlow: Story = {
242
240
  edges={workflowData.workflows[2].edges}
243
241
  height={600}
244
242
  layoutOptions={{
245
- namespaceStrategy: 'first',
246
243
  laneWidth: 200,
247
244
  eventSpacing: 80,
248
245
  }}
@@ -281,7 +278,6 @@ export const ErrorFlow: Story = {
281
278
  edges={workflowData.workflows[3].edges}
282
279
  height={650}
283
280
  layoutOptions={{
284
- namespaceStrategy: 'first',
285
281
  laneWidth: 200,
286
282
  eventSpacing: 80,
287
283
  }}
@@ -313,7 +309,6 @@ export const ComparisonView: Story = {
313
309
  edges={workflowData.workflows[0].edges}
314
310
  height={600}
315
311
  layoutOptions={{
316
- namespaceStrategy: 'first',
317
312
  laneWidth: 180,
318
313
  eventSpacing: 70,
319
314
  }}
@@ -328,7 +323,6 @@ export const ComparisonView: Story = {
328
323
  edges={workflowData.workflows[1].edges}
329
324
  height={600}
330
325
  layoutOptions={{
331
- namespaceStrategy: 'first',
332
326
  laneWidth: 180,
333
327
  eventSpacing: 70,
334
328
  }}
@@ -384,7 +378,6 @@ export const AllPathsOverview: Story = {
384
378
  edges={workflow.edges}
385
379
  height={400}
386
380
  layoutOptions={{
387
- namespaceStrategy: 'first',
388
381
  laneWidth: 160,
389
382
  eventSpacing: 60,
390
383
  laneGap: 40,
@@ -447,7 +440,6 @@ export const UsingWorkflowWrapper: Story = {
447
440
  scenario={scenario}
448
441
  height="100%"
449
442
  layoutOptions={{
450
- namespaceStrategy: 'first',
451
443
  laneWidth: 200,
452
444
  eventSpacing: 80,
453
445
  }}
@@ -466,57 +458,36 @@ export const UsingWorkflowWrapper: Story = {
466
458
  };
467
459
 
468
460
  /**
469
- * **Interactive Namespace Strategy**
461
+ * **Interactive Drill-Down**
470
462
  *
471
- * Demonstrates different namespace grouping strategies.
472
- * Toggle between showing full event namespaces vs collapsed participants.
463
+ * Lanes default to top-level participants. Use the ▶ chevrons on a lane
464
+ * header to drill into its sub-namespaces, and on a child lane to step
465
+ * back out.
473
466
  */
474
- export const InteractiveNamespaceStrategy: Story = {
467
+ export const InteractiveDrillDown: Story = {
475
468
  render: () => {
476
- const [strategy, setStrategy] = React.useState<'first' | 'all-but-last'>('first');
469
+ const [opened, setOpened] = React.useState<string[]>([]);
470
+
471
+ const handleToggle = (namespace: string) => {
472
+ setOpened((prev) =>
473
+ prev.includes(namespace)
474
+ ? prev.filter((n) => n !== namespace)
475
+ : [...prev, namespace]
476
+ );
477
+ };
477
478
 
478
479
  return (
479
480
  <div style={{ height: '100vh', display: 'flex', flexDirection: 'column' }}>
480
481
  <div style={{
481
482
  padding: '12px',
482
483
  background: '#1e1e1e',
483
- borderBottom: '1px solid #3e3e3e'
484
+ borderBottom: '1px solid #3e3e3e',
485
+ color: '#d4d4d4',
484
486
  }}>
485
- <label style={{ marginRight: 16, color: '#d4d4d4' }}>
486
- <strong>Namespace Strategy:</strong>
487
- </label>
488
- <button
489
- onClick={() => setStrategy('first')}
490
- style={{
491
- padding: '8px 16px',
492
- marginRight: 8,
493
- background: strategy === 'first' ? '#3B82F6' : '#2a2a2a',
494
- color: '#d4d4d4',
495
- border: '1px solid #3e3e3e',
496
- borderRadius: 4,
497
- cursor: 'pointer',
498
- }}
499
- >
500
- First Segment (Participants)
501
- </button>
502
- <button
503
- onClick={() => setStrategy('all-but-last')}
504
- style={{
505
- padding: '8px 16px',
506
- background: strategy === 'all-but-last' ? '#3B82F6' : '#2a2a2a',
507
- color: '#d4d4d4',
508
- border: '1px solid #3e3e3e',
509
- borderRadius: 4,
510
- cursor: 'pointer',
511
- }}
512
- >
513
- Detailed Namespaces
514
- </button>
487
+ <strong>Opened:</strong>{' '}
488
+ {opened.length ? opened.join(', ') : 'none (top-level participants)'}
515
489
  <p style={{ fontSize: 13, color: '#858585', marginTop: 8, marginBottom: 0 }}>
516
- {strategy === 'first'
517
- ? 'Showing high-level participants (renderer.*, main.*) - participant-focused view'
518
- : 'Showing detailed event namespaces - event-focused view'
519
- }
490
+ on a lane drills into its sub-namespaces. ‹ on a child lane steps back out.
520
491
  </p>
521
492
  </div>
522
493
  <div style={{ flex: 1 }}>
@@ -525,10 +496,11 @@ export const InteractiveNamespaceStrategy: Story = {
525
496
  edges={workflowData.workflows[1].edges}
526
497
  height={700}
527
498
  layoutOptions={{
528
- namespaceStrategy: strategy,
499
+ openedNamespaces: opened,
529
500
  laneWidth: 200,
530
501
  eventSpacing: 80,
531
502
  }}
503
+ onToggleNamespace={handleToggle}
532
504
  />
533
505
  </div>
534
506
  </div>
@@ -537,7 +509,7 @@ export const InteractiveNamespaceStrategy: Story = {
537
509
  parameters: {
538
510
  docs: {
539
511
  description: {
540
- story: 'Toggle between participant-level and detailed namespace views.',
512
+ story: 'Drill into participant lanes to reveal their sub-namespaces.',
541
513
  },
542
514
  },
543
515
  },
@@ -142,30 +142,14 @@ export const ComplexFlow: Story = {
142
142
  };
143
143
 
144
144
  /**
145
- * Flow with hierarchical namespaces to test sub-namespace handling
145
+ * Flow with hierarchical namespaces. By default, lanes group at the first
146
+ * dotted segment — drill in via `openedNamespaces` (see `WithDrillDown`).
146
147
  */
147
148
  export const HierarchicalNamespaces: Story = {
148
149
  args: {
149
150
  events: hierarchicalFlow.events,
150
151
  edges: hierarchicalFlow.edges,
151
152
  height: 500,
152
- layoutOptions: {
153
- namespaceStrategy: 'all-but-last',
154
- },
155
- },
156
- };
157
-
158
- /**
159
- * Same story but with first-segment namespace strategy
160
- */
161
- export const HierarchicalCollapsedToFirst: Story = {
162
- args: {
163
- events: hierarchicalFlow.events,
164
- edges: hierarchicalFlow.edges,
165
- height: 500,
166
- layoutOptions: {
167
- namespaceStrategy: 'first',
168
- },
169
153
  },
170
154
  };
171
155
 
@@ -181,14 +165,15 @@ export const SameNamespaceEdges: Story = {
181
165
  };
182
166
 
183
167
  /**
184
- * Interactive example with collapse toggle
168
+ * Interactive drill-down. Click on a lane header to split it into
169
+ * its sub-namespaces; click ‹ on a child lane to step back out.
185
170
  */
186
- export const WithCollapseToggle: Story = {
171
+ export const WithDrillDown: Story = {
187
172
  render: () => {
188
- const [collapsed, setCollapsed] = useState<string[]>([]);
173
+ const [opened, setOpened] = useState<string[]>([]);
189
174
 
190
175
  const handleToggle = (namespace: string) => {
191
- setCollapsed((prev) =>
176
+ setOpened((prev) =>
192
177
  prev.includes(namespace)
193
178
  ? prev.filter((n) => n !== namespace)
194
179
  : [...prev, namespace]
@@ -198,19 +183,17 @@ export const WithCollapseToggle: Story = {
198
183
  return (
199
184
  <div>
200
185
  <div style={{ marginBottom: 16 }}>
201
- <strong>Collapsed namespaces:</strong>{' '}
202
- {collapsed.length ? collapsed.join(', ') : 'none'}
186
+ <strong>Opened namespaces:</strong>{' '}
187
+ {opened.length ? opened.join(', ') : 'none'}
203
188
  <br />
204
- <small>Click on lane headers with children to toggle collapse</small>
189
+ <small>▶ on a lane header drills in. on a child lane steps back out.</small>
205
190
  </div>
206
191
  <SequenceDiagramRenderer
207
192
  events={hierarchicalFlow.events}
208
193
  edges={hierarchicalFlow.edges}
209
194
  height={500}
210
- layoutOptions={{
211
- collapsedNamespaces: collapsed,
212
- }}
213
- onToggleCollapse={handleToggle}
195
+ layoutOptions={{ openedNamespaces: opened }}
196
+ onToggleNamespace={handleToggle}
214
197
  />
215
198
  </div>
216
199
  );
@@ -278,7 +278,6 @@ export const ClickDiagnostic: Story = {
278
278
  selectedEventIndex={selectedIndex}
279
279
  onEventIndexChange={handleClick}
280
280
  layoutOptions={{
281
- namespaceStrategy: 'first',
282
281
  eventSpacing: 100,
283
282
  }}
284
283
  />
@@ -296,7 +295,6 @@ export const BasicScenario: Story = {
296
295
  scenario: simpleAuthScenario,
297
296
  height: '100%',
298
297
  layoutOptions: {
299
- namespaceStrategy: 'first',
300
298
  eventSpacing: 80,
301
299
  },
302
300
  },
@@ -311,7 +309,6 @@ export const WithCanvasMetadata: Story = {
311
309
  canvas: sampleCanvas,
312
310
  height: '100%',
313
311
  layoutOptions: {
314
- namespaceStrategy: 'first',
315
312
  eventSpacing: 80,
316
313
  },
317
314
  },
@@ -325,7 +322,6 @@ export const ComplexWorkflow: Story = {
325
322
  scenario: orderProcessingScenario,
326
323
  height: '100%',
327
324
  layoutOptions: {
328
- namespaceStrategy: 'first',
329
325
  laneWidth: 200,
330
326
  eventSpacing: 70,
331
327
  },
@@ -340,7 +336,6 @@ export const MicroservicesPattern: Story = {
340
336
  scenario: microservicesScenario,
341
337
  height: '100%',
342
338
  layoutOptions: {
343
- namespaceStrategy: 'first',
344
339
  laneWidth: 220,
345
340
  eventSpacing: 75,
346
341
  },
@@ -355,7 +350,6 @@ export const ErrorHandling: Story = {
355
350
  scenario: errorHandlingScenario,
356
351
  height: '100%',
357
352
  layoutOptions: {
358
- namespaceStrategy: 'first',
359
353
  eventSpacing: 80,
360
354
  },
361
355
  },
@@ -380,7 +374,6 @@ export const LongSwimlaneTitles: Story = {
380
374
  scenario: longTitlesScenario,
381
375
  height: '100%',
382
376
  layoutOptions: {
383
- namespaceStrategy: 'first',
384
377
  eventSpacing: 80,
385
378
  headerHeight: 100,
386
379
  },
@@ -449,7 +442,6 @@ export const WithEventSelection: Story = {
449
442
  selectedEventIndex={selectedIndex}
450
443
  onEventIndexChange={setSelectedIndex}
451
444
  layoutOptions={{
452
- namespaceStrategy: 'first',
453
445
  eventSpacing: 80,
454
446
  nodeWidth: 14,
455
447
  nodeHeight: 14,
@@ -508,7 +500,6 @@ export const InteractiveSelection: Story = {
508
500
  selectedEventIndex={selectedIndex}
509
501
  onEventIndexChange={setSelectedIndex}
510
502
  layoutOptions={{
511
- namespaceStrategy: 'first',
512
503
  eventSpacing: 80,
513
504
  }}
514
505
  />
@@ -553,7 +544,6 @@ export const EdgeLabelsVsNodeLabels: Story = {
553
544
  onEventIndexChange={setSelectedLeft}
554
545
  showEventLabels={false}
555
546
  layoutOptions={{
556
- namespaceStrategy: 'first',
557
547
  eventSpacing: 100,
558
548
  }}
559
549
  />
@@ -583,7 +573,6 @@ export const EdgeLabelsVsNodeLabels: Story = {
583
573
  onEventIndexChange={setSelectedRight}
584
574
  showEventLabels={true}
585
575
  layoutOptions={{
586
- namespaceStrategy: 'first',
587
576
  eventSpacing: 100,
588
577
  nodeWidth: 80,
589
578
  nodeHeight: 50,
@@ -597,34 +586,38 @@ export const EdgeLabelsVsNodeLabels: Story = {
597
586
  };
598
587
 
599
588
  /**
600
- * Comparison of different namespace strategies
589
+ * Comparison of default lanes vs fully-drilled lanes
601
590
  */
602
- export const NamespaceStrategies: Story = {
591
+ export const DefaultVsDrilled: Story = {
603
592
  render: () => {
593
+ const allTopSegments = Array.from(
594
+ new Set(
595
+ Object.keys(orderProcessingScenario.template.events ?? {})
596
+ .map((name) => name.split('.')[0])
597
+ .filter(Boolean)
598
+ )
599
+ );
600
+
604
601
  return (
605
602
  <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', height: '100%', gap: 16 }}>
606
603
  <div style={{ display: 'flex', flexDirection: 'column' }}>
607
- <h3 style={{ margin: '0 0 12px 0' }}>First Segment (Participants)</h3>
604
+ <h3 style={{ margin: '0 0 12px 0' }}>Default (top-level lanes)</h3>
608
605
  <div style={{ flex: 1, border: '1px solid #ddd', borderRadius: 4 }}>
609
606
  <WorkflowSequenceDiagram
610
607
  scenario={orderProcessingScenario}
611
608
  height="100%"
612
- layoutOptions={{
613
- namespaceStrategy: 'first',
614
- laneWidth: 180,
615
- eventSpacing: 60,
616
- }}
609
+ layoutOptions={{ laneWidth: 180, eventSpacing: 60 }}
617
610
  />
618
611
  </div>
619
612
  </div>
620
613
  <div style={{ display: 'flex', flexDirection: 'column' }}>
621
- <h3 style={{ margin: '0 0 12px 0' }}>All But Last (Detailed)</h3>
614
+ <h3 style={{ margin: '0 0 12px 0' }}>All top-level lanes drilled</h3>
622
615
  <div style={{ flex: 1, border: '1px solid #ddd', borderRadius: 4 }}>
623
616
  <WorkflowSequenceDiagram
624
617
  scenario={orderProcessingScenario}
625
618
  height="100%"
626
619
  layoutOptions={{
627
- namespaceStrategy: 'all-but-last',
620
+ openedNamespaces: allTopSegments,
628
621
  laneWidth: 180,
629
622
  eventSpacing: 60,
630
623
  }}
@@ -644,7 +637,6 @@ export const CompactLayout: Story = {
644
637
  scenario: simpleAuthScenario,
645
638
  height: '100%',
646
639
  layoutOptions: {
647
- namespaceStrategy: 'first',
648
640
  laneWidth: 150,
649
641
  laneGap: 30,
650
642
  eventSpacing: 50,
@@ -660,7 +652,6 @@ export const SpaciousLayout: Story = {
660
652
  scenario: simpleAuthScenario,
661
653
  height: '100%',
662
654
  layoutOptions: {
663
- namespaceStrategy: 'first',
664
655
  laneWidth: 250,
665
656
  laneGap: 100,
666
657
  eventSpacing: 120,
@@ -677,7 +668,6 @@ export const WithoutControls: Story = {
677
668
  height: '100%',
678
669
  showControls: false,
679
670
  layoutOptions: {
680
- namespaceStrategy: 'first',
681
671
  eventSpacing: 80,
682
672
  },
683
673
  },
@@ -692,7 +682,6 @@ export const WithBackground: Story = {
692
682
  height: '100%',
693
683
  showBackground: true,
694
684
  layoutOptions: {
695
- namespaceStrategy: 'first',
696
685
  eventSpacing: 80,
697
686
  },
698
687
  },
@@ -802,7 +791,6 @@ export const FullFeatured: Story = {
802
791
  showControls={showControls}
803
792
  showBackground={showBackground}
804
793
  layoutOptions={{
805
- namespaceStrategy: 'first',
806
794
  laneWidth: 200,
807
795
  eventSpacing: 70,
808
796
  }}