@principal-ai/subsystems-react 0.56.5 → 0.56.7

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.
@@ -28,6 +28,7 @@ import {
28
28
  type TrailComponentLabels,
29
29
  } from './trailStepDisplay';
30
30
  import { buildTrailStack } from './trailStack';
31
+ import { TrailStepsNav } from './TrailStepsNav';
31
32
 
32
33
  /** Pause (ms) between steps when a trail autoplays. */
33
34
  export const TRAIL_PLAY_PAUSE_MS = 2500;
@@ -83,6 +84,7 @@ function TrailFlow({
83
84
  stepEmphasis,
84
85
  onRemoveStepEmphasis,
85
86
  componentByAlias,
87
+ hideHeader = false,
86
88
  }: {
87
89
  trail: SubsystemTrail;
88
90
  collapsed: boolean;
@@ -121,6 +123,8 @@ function TrailFlow({
121
123
  onRemoveStepEmphasis?: (tl: SubsystemTrail, stepIndex: number) => void;
122
124
  /** Alias → component, for turning hops into human display names. */
123
125
  componentByAlias?: TrailComponentLabels;
126
+ /** The shared drill-down navigation supplies the trail header. */
127
+ hideHeader?: boolean;
124
128
  }) {
125
129
  const { theme } = useTheme();
126
130
  const muted = theme.colors.textMuted ?? theme.colors.textSecondary;
@@ -272,7 +276,7 @@ function TrailFlow({
272
276
 
273
277
  return (
274
278
  <div>
275
- <div
279
+ {!hideHeader && <div
276
280
  onMouseEnter={() => {
277
281
  if (isHoverSuppressed?.()) return;
278
282
  setHeaderHover(true);
@@ -502,7 +506,7 @@ function TrailFlow({
502
506
  <GripVertical size={14} strokeWidth={2} />
503
507
  </span>
504
508
  )}
505
- </div>
509
+ </div>}
506
510
  {!collapsed && (
507
511
  <div
508
512
  style={{ display: 'flex', flexDirection: 'column' }}
@@ -595,16 +599,38 @@ function TrailFlow({
595
599
  style={{
596
600
  flex: 1,
597
601
  minWidth: 0,
602
+ display: 'flex',
603
+ flexDirection: 'column',
604
+ gap: 2,
598
605
  overflowWrap: 'anywhere',
599
606
  whiteSpace: 'normal',
600
- fontSize: theme.fontSizes[1],
601
- fontFamily: theme.fonts.monospace,
602
- color: record
603
- ? EMPHASIS_COLOR
604
- : theme.colors.text,
605
607
  }}
606
608
  >
607
- {display.primary}
609
+ {step.annotation && (
610
+ <span
611
+ style={{
612
+ minWidth: 0,
613
+ overflowWrap: 'anywhere',
614
+ fontSize: theme.fontSizes[1],
615
+ fontFamily: theme.fonts.body,
616
+ color: theme.colors.primary,
617
+ lineHeight: 1.35,
618
+ }}
619
+ >
620
+ {step.annotation}
621
+ </span>
622
+ )}
623
+ <span
624
+ style={{
625
+ minWidth: 0,
626
+ overflowWrap: 'anywhere',
627
+ fontSize: theme.fontSizes[1],
628
+ fontFamily: theme.fonts.monospace,
629
+ color: record ? EMPHASIS_COLOR : theme.colors.text,
630
+ }}
631
+ >
632
+ {display.primary}
633
+ </span>
608
634
  </span>
609
635
  </button>
610
636
  {record && (
@@ -758,6 +784,8 @@ export interface TrailsPanelProps {
758
784
  onRemoveStepEmphasis?: (tl: SubsystemTrail, stepIndex: number) => void;
759
785
  /** Alias → component, for turning hops into human display names. */
760
786
  componentByAlias?: TrailComponentLabels;
787
+ /** Slide from the trail list into its steps, without playback controls. */
788
+ drilldown?: boolean;
761
789
  }
762
790
 
763
791
  /**
@@ -784,12 +812,13 @@ export function TrailsPanel({
784
812
  stepEmphasis,
785
813
  onRemoveStepEmphasis,
786
814
  componentByAlias,
815
+ drilldown = false,
787
816
  }: TrailsPanelProps) {
788
817
  const { theme } = useTheme();
789
818
  // Reordering is offered only while every row is collapsed: the compact list
790
819
  // is what you drag, and expanded step lists would make drop targets tall and
791
820
  // the landing boundary ambiguous.
792
- const allCollapsed = trails.every((w) => !expandedTrails.has(w.id));
821
+ const allCollapsed = drilldown || trails.every((w) => !expandedTrails.has(w.id));
793
822
  const reorderable = onReorder != null && allCollapsed;
794
823
  // Row being dragged, and the gap the pointer is over (boundaries 0..n
795
824
  // between rows). The boundary is where the dragged row will be inserted.
@@ -871,7 +900,7 @@ export function TrailsPanel({
871
900
  const accent = theme.colors.accent ?? theme.colors.primary ?? theme.colors.text;
872
901
  const isHoverSuppressed = useCallback(() => suppressHoverRef.current, []);
873
902
 
874
- return (
903
+ const list = (
875
904
  <div
876
905
  style={{
877
906
  flex: 1,
@@ -936,7 +965,7 @@ export function TrailsPanel({
936
965
  )}
937
966
  <TrailFlow
938
967
  trail={tl}
939
- collapsed={!expandedTrails.has(tl.id)}
968
+ collapsed={drilldown || !expandedTrails.has(tl.id)}
940
969
  active={
941
970
  focusedTrailId === tl.id
942
971
  ? { stepIndex: focusedStepIndex }
@@ -945,7 +974,7 @@ export function TrailsPanel({
945
974
  : null
946
975
  }
947
976
  focusedStepIndex={focusedTrailId === tl.id ? focusedStepIndex : null}
948
- onToggleCollapsed={onToggleCollapsed}
977
+ onToggleCollapsed={drilldown ? () => {} : onToggleCollapsed}
949
978
  onFocusFlow={onFocusFlow}
950
979
  onClearFocus={onClearFocus}
951
980
  onFocusStep={onFocusStep}
@@ -977,4 +1006,49 @@ export function TrailsPanel({
977
1006
  })}
978
1007
  </div>
979
1008
  );
1009
+
1010
+ if (!drilldown) return list;
1011
+
1012
+ return (
1013
+ <TrailStepsNav
1014
+ trails={trails}
1015
+ focusedTrailId={focusedTrailId}
1016
+ focusedStepIndex={focusedStepIndex}
1017
+ hoveredTrailStep={hoveredTrailStep}
1018
+ onFocusFlow={onFocusFlow}
1019
+ onClearFocus={onClearFocus}
1020
+ onFocusStep={onFocusStep}
1021
+ onHoverStep={onHoverStep}
1022
+ onHoverFlow={onHoverFlow}
1023
+ onLeaveStep={onLeaveStep}
1024
+ componentByAlias={componentByAlias}
1025
+ listContent={list}
1026
+ renderSteps={(trail) => (
1027
+ <TrailFlow
1028
+ key={trail.id}
1029
+ trail={trail}
1030
+ collapsed={false}
1031
+ hideHeader
1032
+ active={
1033
+ focusedTrailId === trail.id
1034
+ ? { stepIndex: focusedStepIndex }
1035
+ : hoveredTrailStep?.trailId === trail.id
1036
+ ? { stepIndex: hoveredTrailStep.stepIndex }
1037
+ : null
1038
+ }
1039
+ focusedStepIndex={focusedTrailId === trail.id ? focusedStepIndex : null}
1040
+ onToggleCollapsed={onToggleCollapsed}
1041
+ onFocusFlow={onFocusFlow}
1042
+ onClearFocus={onClearFocus}
1043
+ onFocusStep={onFocusStep}
1044
+ onHoverStep={onHoverStep}
1045
+ onHoverFlow={onHoverFlow}
1046
+ onLeaveStep={onLeaveStep}
1047
+ componentByAlias={componentByAlias}
1048
+ stepEmphasis={stepEmphasis}
1049
+ onRemoveStepEmphasis={onRemoveStepEmphasis}
1050
+ />
1051
+ )}
1052
+ />
1053
+ );
980
1054
  }