@principal-ai/subsystems-react 0.56.4 → 0.56.6

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' }}
@@ -758,6 +762,8 @@ export interface TrailsPanelProps {
758
762
  onRemoveStepEmphasis?: (tl: SubsystemTrail, stepIndex: number) => void;
759
763
  /** Alias → component, for turning hops into human display names. */
760
764
  componentByAlias?: TrailComponentLabels;
765
+ /** Slide from the trail list into its steps, without playback controls. */
766
+ drilldown?: boolean;
761
767
  }
762
768
 
763
769
  /**
@@ -784,12 +790,13 @@ export function TrailsPanel({
784
790
  stepEmphasis,
785
791
  onRemoveStepEmphasis,
786
792
  componentByAlias,
793
+ drilldown = false,
787
794
  }: TrailsPanelProps) {
788
795
  const { theme } = useTheme();
789
796
  // Reordering is offered only while every row is collapsed: the compact list
790
797
  // is what you drag, and expanded step lists would make drop targets tall and
791
798
  // the landing boundary ambiguous.
792
- const allCollapsed = trails.every((w) => !expandedTrails.has(w.id));
799
+ const allCollapsed = drilldown || trails.every((w) => !expandedTrails.has(w.id));
793
800
  const reorderable = onReorder != null && allCollapsed;
794
801
  // Row being dragged, and the gap the pointer is over (boundaries 0..n
795
802
  // between rows). The boundary is where the dragged row will be inserted.
@@ -871,7 +878,7 @@ export function TrailsPanel({
871
878
  const accent = theme.colors.accent ?? theme.colors.primary ?? theme.colors.text;
872
879
  const isHoverSuppressed = useCallback(() => suppressHoverRef.current, []);
873
880
 
874
- return (
881
+ const list = (
875
882
  <div
876
883
  style={{
877
884
  flex: 1,
@@ -936,7 +943,7 @@ export function TrailsPanel({
936
943
  )}
937
944
  <TrailFlow
938
945
  trail={tl}
939
- collapsed={!expandedTrails.has(tl.id)}
946
+ collapsed={drilldown || !expandedTrails.has(tl.id)}
940
947
  active={
941
948
  focusedTrailId === tl.id
942
949
  ? { stepIndex: focusedStepIndex }
@@ -945,7 +952,7 @@ export function TrailsPanel({
945
952
  : null
946
953
  }
947
954
  focusedStepIndex={focusedTrailId === tl.id ? focusedStepIndex : null}
948
- onToggleCollapsed={onToggleCollapsed}
955
+ onToggleCollapsed={drilldown ? () => {} : onToggleCollapsed}
949
956
  onFocusFlow={onFocusFlow}
950
957
  onClearFocus={onClearFocus}
951
958
  onFocusStep={onFocusStep}
@@ -977,4 +984,49 @@ export function TrailsPanel({
977
984
  })}
978
985
  </div>
979
986
  );
987
+
988
+ if (!drilldown) return list;
989
+
990
+ return (
991
+ <TrailStepsNav
992
+ trails={trails}
993
+ focusedTrailId={focusedTrailId}
994
+ focusedStepIndex={focusedStepIndex}
995
+ hoveredTrailStep={hoveredTrailStep}
996
+ onFocusFlow={onFocusFlow}
997
+ onClearFocus={onClearFocus}
998
+ onFocusStep={onFocusStep}
999
+ onHoverStep={onHoverStep}
1000
+ onHoverFlow={onHoverFlow}
1001
+ onLeaveStep={onLeaveStep}
1002
+ componentByAlias={componentByAlias}
1003
+ listContent={list}
1004
+ renderSteps={(trail) => (
1005
+ <TrailFlow
1006
+ key={trail.id}
1007
+ trail={trail}
1008
+ collapsed={false}
1009
+ hideHeader
1010
+ active={
1011
+ focusedTrailId === trail.id
1012
+ ? { stepIndex: focusedStepIndex }
1013
+ : hoveredTrailStep?.trailId === trail.id
1014
+ ? { stepIndex: hoveredTrailStep.stepIndex }
1015
+ : null
1016
+ }
1017
+ focusedStepIndex={focusedTrailId === trail.id ? focusedStepIndex : null}
1018
+ onToggleCollapsed={onToggleCollapsed}
1019
+ onFocusFlow={onFocusFlow}
1020
+ onClearFocus={onClearFocus}
1021
+ onFocusStep={onFocusStep}
1022
+ onHoverStep={onHoverStep}
1023
+ onHoverFlow={onHoverFlow}
1024
+ onLeaveStep={onLeaveStep}
1025
+ componentByAlias={componentByAlias}
1026
+ stepEmphasis={stepEmphasis}
1027
+ onRemoveStepEmphasis={onRemoveStepEmphasis}
1028
+ />
1029
+ )}
1030
+ />
1031
+ );
980
1032
  }