@principal-ai/subsystems-react 0.56.39 → 0.56.40
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.
- package/dist/subsystem/SubsystemComponentGraph.d.ts +5 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +2 -2
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailIcon.d.ts +18 -4
- package/dist/subsystem/TrailIcon.d.ts.map +1 -1
- package/dist/subsystem/TrailIcon.js +35 -24
- package/dist/subsystem/TrailIcon.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +3 -1
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +28 -17
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/package.json +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +7 -1
- package/src/subsystem/TrailIcon.tsx +60 -34
- package/src/subsystem/TrailsPanel.test.tsx +51 -0
- package/src/subsystem/TrailsPanel.tsx +40 -11
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from './trailStepDisplay';
|
|
32
32
|
import { buildTrailStack } from './trailStack';
|
|
33
33
|
import { TrailStepsNav } from './TrailStepsNav';
|
|
34
|
-
import { TrailIcon, type TrailChange } from './TrailIcon';
|
|
34
|
+
import { ChangeBadge, TrailIcon, trailChangeColor, type TrailChange } from './TrailIcon';
|
|
35
35
|
|
|
36
36
|
/** Pause (ms) between steps when a trail autoplays. */
|
|
37
37
|
export const TRAIL_PLAY_PAUSE_MS = 2500;
|
|
@@ -55,6 +55,13 @@ export interface TrailsStepChange {
|
|
|
55
55
|
previous: SubsystemTrailStep;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/** Tooltip for a step the host marks as changed. */
|
|
59
|
+
const STEP_CHANGE_LABEL: Record<TrailChange, string> = {
|
|
60
|
+
added: 'Added step',
|
|
61
|
+
removed: 'Removed step',
|
|
62
|
+
changed: 'Changed step',
|
|
63
|
+
};
|
|
64
|
+
|
|
58
65
|
/** How long a step's number shows its "copied" checkmark (ms). */
|
|
59
66
|
export const STEP_COPY_FEEDBACK_MS = 2000;
|
|
60
67
|
|
|
@@ -97,6 +104,7 @@ function TrailFlow({
|
|
|
97
104
|
hideHeader = false,
|
|
98
105
|
proposed = false,
|
|
99
106
|
change,
|
|
107
|
+
stepChanges,
|
|
100
108
|
proposedStepKeys,
|
|
101
109
|
focusedVariationStepIndexes,
|
|
102
110
|
stepNumberLabels,
|
|
@@ -145,6 +153,8 @@ function TrailFlow({
|
|
|
145
153
|
proposed?: boolean;
|
|
146
154
|
/** What the host says is happening to this trail; its icon shows it. */
|
|
147
155
|
change?: TrailChange;
|
|
156
|
+
/** What the host says is happening to individual steps, by index; the step's number shows it. */
|
|
157
|
+
stepChanges?: ReadonlyMap<number, TrailChange>;
|
|
148
158
|
/** Host-local proposed steps, keyed by `emphasisKey(trailId, step)`. */
|
|
149
159
|
proposedStepKeys?: Set<string>;
|
|
150
160
|
/** Step indexes that belong to one focused variation group in this flow. */
|
|
@@ -550,6 +560,8 @@ function TrailFlow({
|
|
|
550
560
|
const record = stepEmphasis?.get(stepKey);
|
|
551
561
|
const stepProposed = proposed || (proposedStepKeys?.has(stepKey) ?? false);
|
|
552
562
|
const stepNumber = stepNumberLabels?.get(stepKey) ?? String(i + 1);
|
|
563
|
+
const stepChangeMark = stepChanges?.get(i);
|
|
564
|
+
const stepTone = stepChangeMark ? trailChangeColor(theme, stepChangeMark) : null;
|
|
553
565
|
const display = trailStepDisplay(step, componentByAlias);
|
|
554
566
|
// The original step keeps its row after acceptance; only its
|
|
555
567
|
// annotation is greyed. Its `2a` variation stays beside it.
|
|
@@ -616,26 +628,38 @@ function TrailFlow({
|
|
|
616
628
|
<span
|
|
617
629
|
role={copied ? 'status' : undefined}
|
|
618
630
|
aria-label={copied ? 'Copied' : undefined}
|
|
631
|
+
title={stepChangeMark ? STEP_CHANGE_LABEL[stepChangeMark] : undefined}
|
|
619
632
|
style={{
|
|
633
|
+
position: 'relative',
|
|
620
634
|
flexShrink: 0,
|
|
621
635
|
width: 14,
|
|
622
636
|
textAlign: 'center',
|
|
623
637
|
paddingTop: 1,
|
|
624
638
|
fontSize: theme.fontSizes[0],
|
|
625
639
|
fontFamily: theme.fonts.monospace,
|
|
626
|
-
fontWeight: record ? 700 : undefined,
|
|
627
|
-
color:
|
|
628
|
-
?
|
|
629
|
-
:
|
|
630
|
-
?
|
|
631
|
-
:
|
|
632
|
-
?
|
|
633
|
-
:
|
|
634
|
-
?
|
|
635
|
-
:
|
|
640
|
+
fontWeight: record || stepTone ? 700 : undefined,
|
|
641
|
+
color: copied
|
|
642
|
+
? theme.colors.primary
|
|
643
|
+
: stepTone
|
|
644
|
+
? stepTone
|
|
645
|
+
: stepProposed
|
|
646
|
+
? proposalColor
|
|
647
|
+
: record
|
|
648
|
+
? EMPHASIS_COLOR
|
|
649
|
+
: stepActive
|
|
650
|
+
? theme.colors.text
|
|
651
|
+
: muted,
|
|
636
652
|
}}
|
|
637
653
|
>
|
|
638
654
|
{copied ? <Check size={12} strokeWidth={2} aria-hidden /> : stepNumber}
|
|
655
|
+
{stepChangeMark && stepTone && !copied && (
|
|
656
|
+
<ChangeBadge
|
|
657
|
+
change={stepChangeMark}
|
|
658
|
+
size={14}
|
|
659
|
+
tone={stepTone}
|
|
660
|
+
ring={theme.colors.backgroundSecondary ?? theme.colors.background}
|
|
661
|
+
/>
|
|
662
|
+
)}
|
|
639
663
|
</span>
|
|
640
664
|
<span
|
|
641
665
|
style={{
|
|
@@ -801,6 +825,8 @@ export interface TrailsPanelProps {
|
|
|
801
825
|
highlightedTrailIds?: ReadonlySet<string>;
|
|
802
826
|
/** What the host says is happening to each trail, by id. Marks the trail's icon. */
|
|
803
827
|
trailChanges?: ReadonlyMap<string, TrailChange>;
|
|
828
|
+
/** What the host says is happening to individual steps: trail id → step index → change. */
|
|
829
|
+
stepChanges?: ReadonlyMap<string, ReadonlyMap<number, TrailChange>>;
|
|
804
830
|
/** Host-local steps awaiting confirmation, keyed by `emphasisKey`. */
|
|
805
831
|
proposedStepKeys?: Set<string>;
|
|
806
832
|
/** Step indexes that belong to one focused variation group, by trail id. */
|
|
@@ -840,6 +866,7 @@ export function TrailsPanel({
|
|
|
840
866
|
proposedTrailIds,
|
|
841
867
|
highlightedTrailIds,
|
|
842
868
|
trailChanges,
|
|
869
|
+
stepChanges,
|
|
843
870
|
proposedStepKeys,
|
|
844
871
|
focusedVariationStepIndexes,
|
|
845
872
|
stepNumberLabels,
|
|
@@ -1037,6 +1064,7 @@ export function TrailsPanel({
|
|
|
1037
1064
|
onRemoveStepEmphasis={onRemoveStepEmphasis}
|
|
1038
1065
|
proposed={proposedTrailIds?.has(tl.id) ?? false}
|
|
1039
1066
|
change={trailChanges?.get(tl.id)}
|
|
1067
|
+
stepChanges={stepChanges?.get(tl.id)}
|
|
1040
1068
|
proposedStepKeys={proposedStepKeys}
|
|
1041
1069
|
focusedVariationStepIndexes={focusedVariationStepIndexes?.get(tl.id)}
|
|
1042
1070
|
stepNumberLabels={stepNumberLabels}
|
|
@@ -1092,6 +1120,7 @@ export function TrailsPanel({
|
|
|
1092
1120
|
stepEmphasis={stepEmphasis}
|
|
1093
1121
|
onRemoveStepEmphasis={onRemoveStepEmphasis}
|
|
1094
1122
|
proposed={proposedTrailIds?.has(trail.id) ?? false}
|
|
1123
|
+
stepChanges={stepChanges?.get(trail.id)}
|
|
1095
1124
|
proposedStepKeys={proposedStepKeys}
|
|
1096
1125
|
focusedVariationStepIndexes={focusedVariationStepIndexes?.get(trail.id)}
|
|
1097
1126
|
stepNumberLabels={stepNumberLabels}
|