@principal-ai/subsystems-react 0.56.35 → 0.56.36
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 +50 -8
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +291 -50
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailStepsNav.d.ts +1 -1
- package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
- package/dist/subsystem/TrailStepsNav.js +2 -1
- package/dist/subsystem/TrailStepsNav.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +5 -5
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +23 -43
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/model.d.ts +21 -6
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js +48 -45
- package/dist/subsystem/model.js.map +1 -1
- package/dist/subsystem/nodeIconography.d.ts +25 -0
- package/dist/subsystem/nodeIconography.d.ts.map +1 -0
- package/dist/subsystem/nodeIconography.js +55 -0
- package/dist/subsystem/nodeIconography.js.map +1 -0
- package/dist/subsystem/nodes.d.ts +4 -3
- package/dist/subsystem/nodes.d.ts.map +1 -1
- package/dist/subsystem/nodes.js +125 -211
- package/dist/subsystem/nodes.js.map +1 -1
- package/dist/subsystem/stepEmphasis.d.ts +5 -0
- package/dist/subsystem/stepEmphasis.d.ts.map +1 -1
- package/dist/subsystem/stepEmphasis.js +7 -0
- package/dist/subsystem/stepEmphasis.js.map +1 -1
- package/package.json +1 -1
- package/src/stories/Canvases/Subsystem/AgentDrivenWalkthrough.stories.tsx +229 -157
- package/src/stories/Canvases/Subsystem/Deprecated.stories.tsx +1 -1
- package/src/stories/Canvases/Subsystem/NodeAnatomy.stories.tsx +17 -21
- package/src/stories/Canvases/Subsystem/NodeIconography.stories.tsx +791 -21
- package/src/stories/Canvases/Subsystem/Spotlights.stories.tsx +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +359 -62
- package/src/subsystem/TrailStepsNav.tsx +2 -2
- package/src/subsystem/TrailsPanel.tsx +35 -89
- package/src/subsystem/model.test.ts +17 -13
- package/src/subsystem/model.ts +60 -48
- package/src/subsystem/nodeIconography.ts +88 -0
- package/src/subsystem/nodes.component.test.tsx +177 -0
- package/src/subsystem/nodes.tsx +225 -268
- package/src/subsystem/stepEmphasis.ts +8 -0
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
processGroupNodeId,
|
|
50
50
|
isTrailMechanism,
|
|
51
51
|
edgeColor,
|
|
52
|
+
HOST_PROPOSAL_COLOR,
|
|
52
53
|
MECHANISM_DESCRIPTIONS,
|
|
53
54
|
subsystemGraphLayoutKey,
|
|
54
55
|
trailStepGraphEdgeId,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
type SubsystemRegionDetails,
|
|
66
67
|
type SubsystemRegionIssue,
|
|
67
68
|
type SubsystemTrail,
|
|
69
|
+
type SubsystemTrailStep,
|
|
68
70
|
} from './model';
|
|
69
71
|
import { ConstructsCatalog } from './ConstructsCatalog';
|
|
70
72
|
import { ContainersPanel, type ContainerListItem } from './ContainersPanel';
|
|
@@ -111,7 +113,7 @@ import {
|
|
|
111
113
|
TRAIL_HOVER_PREVIEW_MS,
|
|
112
114
|
type TrailsStepChange,
|
|
113
115
|
} from './TrailsPanel';
|
|
114
|
-
import type
|
|
116
|
+
import { emphasisKey, variationStepNumber, type StepEmphasisMap } from './stepEmphasis';
|
|
115
117
|
import {
|
|
116
118
|
EDGE_LABEL_WIDTH,
|
|
117
119
|
EDGE_LABEL_HEIGHT,
|
|
@@ -266,6 +268,34 @@ export interface SubsystemNodeRect {
|
|
|
266
268
|
height: number;
|
|
267
269
|
}
|
|
268
270
|
|
|
271
|
+
/**
|
|
272
|
+
* PROTOTYPE: host-local link between a step and its unchanged state. The
|
|
273
|
+
* previous step is laid out and framed with its replacement (or with the
|
|
274
|
+
* flow it was removed from), but never written back to the portable model.
|
|
275
|
+
*/
|
|
276
|
+
export interface SubsystemTrailStepHistory {
|
|
277
|
+
trailId: string;
|
|
278
|
+
/** Index in the current trail; for a removed step, its original index. */
|
|
279
|
+
stepIndex: number;
|
|
280
|
+
/** The step as it was before the host-local change. */
|
|
281
|
+
previous: SubsystemTrailStep;
|
|
282
|
+
/** `changed` keeps a replacement at `stepIndex`; `removed` drops the step. */
|
|
283
|
+
kind: 'changed' | 'removed';
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* PROTOTYPE: a step change staged by the host but not yet committed. The
|
|
288
|
+
* proposed step is laid out and framed beside the existing step so the before
|
|
289
|
+
* and after are visible together while the agent is working.
|
|
290
|
+
*/
|
|
291
|
+
export interface SubsystemTrailStepProposal {
|
|
292
|
+
trailId: string;
|
|
293
|
+
/** Index of the step being replaced. */
|
|
294
|
+
stepIndex: number;
|
|
295
|
+
/** The staged replacement. */
|
|
296
|
+
step: SubsystemTrailStep;
|
|
297
|
+
}
|
|
298
|
+
|
|
269
299
|
export interface SubsystemComponentGraphProps {
|
|
270
300
|
components: SubsystemComponent[];
|
|
271
301
|
/**
|
|
@@ -368,14 +398,30 @@ export interface SubsystemComponentGraphProps {
|
|
|
368
398
|
proposedStepKeys?: Set<string>;
|
|
369
399
|
/**
|
|
370
400
|
* PROTOTYPE: host-local before/after view for an accepted step replacement.
|
|
371
|
-
* The previous step
|
|
372
|
-
*
|
|
401
|
+
* The previous step keeps its row and its annotation is greyed; the accepted
|
|
402
|
+
* variation stays beside it with its `2a` label.
|
|
373
403
|
*/
|
|
374
404
|
stepChange?: TrailsStepChange | null;
|
|
375
|
-
/**
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
|
|
405
|
+
/** PROTOTYPE: host-local panel step-number overrides keyed by `emphasisKey`. */
|
|
406
|
+
stepNumberLabels?: ReadonlyMap<string, string>;
|
|
407
|
+
/**
|
|
408
|
+
* PROTOTYPE: unchanged steps associated with accepted host-local changes.
|
|
409
|
+
* They stay in layout/camera bounds with their replacements so before and
|
|
410
|
+
* after are visible together, but do not appear as live steps in the panel.
|
|
411
|
+
*/
|
|
412
|
+
stepHistory?: readonly SubsystemTrailStepHistory[];
|
|
413
|
+
/**
|
|
414
|
+
* PROTOTYPE: staged step replacement awaiting confirmation. It is included
|
|
415
|
+
* in layout and focus beside the existing step, but never committed to the
|
|
416
|
+
* portable `trails` array by the graph.
|
|
417
|
+
*/
|
|
418
|
+
proposedStep?: SubsystemTrailStepProposal | null;
|
|
419
|
+
/**
|
|
420
|
+
* PROTOTYPE: host-local step indexes that belong to one variation group.
|
|
421
|
+
* Every index in a group is focused/framed together, even though the host
|
|
422
|
+
* still names one `focusedTrailStep` as the active guide step.
|
|
423
|
+
*/
|
|
424
|
+
focusedVariationStepIndexes?: ReadonlyMap<string, ReadonlySet<number>>;
|
|
379
425
|
/**
|
|
380
426
|
* PROTOTYPE: host-local component aliases awaiting confirmation. Their boxes
|
|
381
427
|
* use the proposal border, name colour and `PROPOSED` badge.
|
|
@@ -817,7 +863,7 @@ interface InnerProps extends SubsystemComponentGraphProps {
|
|
|
817
863
|
onSidebarTrailChange: (trailId: string | null) => void;
|
|
818
864
|
}
|
|
819
865
|
|
|
820
|
-
function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirection: layoutDirectionProp, defaultLayoutDirection = 'horizontal', onLayoutDirectionChange, hideLayoutToggle = false, refocusOnLayoutFlip = true, initialTrailId, onTrailSelect, focusedTrailStep, proposedTrailIds, proposedStepKeys, stepChange,
|
|
866
|
+
function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirection: layoutDirectionProp, defaultLayoutDirection = 'horizontal', onLayoutDirectionChange, hideLayoutToggle = false, refocusOnLayoutFlip = true, initialTrailId, onTrailSelect, focusedTrailStep, proposedTrailIds, proposedStepKeys, stepChange, stepNumberLabels: hostStepNumberLabels, stepHistory, proposedStep, focusedVariationStepIndexes, proposedComponentAliases, workingComponentAliases, removedComponentAliases, onTrailStepHover, onReorderTrails, stepEmphasis, onRemoveStepEmphasis, onSelect, onEdgeSelect, measured: _measured, maxNodeWidth, showEdgeLabels, showSingletonFrames = true, moduleNesting, edgeView, hideSidebar, trailStepMode = 'focus', autoPlayTrails = false, trailAutoPlayIntervalMs = TRAIL_PLAY_PAUSE_MS, onAutoPlayStep, zoomOnTrailFocus = true, trailFocusDurationMs = 300, focusVerticalBiasPx = 0, graphTitle, showTrailTitle = false, description, notes, canvasOverlay, interactive = true, canvasBackground = 'theme', onLayoutReady, onNodeRects, sidebarExtra, sidebarAfterDescription, issues, showIssues, filesActive, sidebarScope, onSidebarTrailChange, focusIssueCategory, laneStatus, onSelectIssue, onApplyIssueFix, onHoverIssue, renderFileViewer, renderTrailViewer, onFileSelect, componentVerification, onInspectSymbol, boundaryColors, codeProcessKeys, regionDetails, defaultFramesCollapsed, containersActive, hideDrawer = false, persistKey, liveEvents, agentsPanel }: InnerProps) {
|
|
821
867
|
const { theme } = useTheme();
|
|
822
868
|
const { fitView, fitBounds, setViewport } = useReactFlow();
|
|
823
869
|
const flowWidth = useStore((state) => state.width);
|
|
@@ -840,9 +886,129 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
840
886
|
// Restored once per mount from `localStorage` (see `readViewState`). Each
|
|
841
887
|
// graph is its own tab/mount, so `persistKey` is stable for a mount.
|
|
842
888
|
const persisted = useMemo(() => readViewState(persistKey), [persistKey]);
|
|
889
|
+
// Host-local before/after links. The graph keeps the unchanged step in its
|
|
890
|
+
// layout and camera bounds, while the sidebar still renders only live steps.
|
|
891
|
+
const ghostLinksByTrail = useMemo(() => {
|
|
892
|
+
const map = new Map<string, SubsystemTrailStepHistory[]>();
|
|
893
|
+
for (const link of stepHistory ?? []) {
|
|
894
|
+
const list = map.get(link.trailId) ?? [];
|
|
895
|
+
list.push(link);
|
|
896
|
+
map.set(link.trailId, list);
|
|
897
|
+
}
|
|
898
|
+
return map;
|
|
899
|
+
}, [stepHistory]);
|
|
900
|
+
const proposedEdgeId = proposedStep
|
|
901
|
+
? trailStepGraphEdgeId(proposedStep.step)
|
|
902
|
+
: null;
|
|
903
|
+
const proposedEdgeIds = useMemo(
|
|
904
|
+
() => new Set(proposedEdgeId ? [proposedEdgeId] : []),
|
|
905
|
+
[proposedEdgeId],
|
|
906
|
+
);
|
|
907
|
+
// The staged step is a variation of the step it would replace, not the next
|
|
908
|
+
// sequential step. Share that label with the panel and the canvas edge.
|
|
909
|
+
const proposedStepLabel = proposedStep
|
|
910
|
+
? variationStepNumber(proposedStep.stepIndex + 1)
|
|
911
|
+
: null;
|
|
912
|
+
const proposedStepNumberLabels = useMemo(
|
|
913
|
+
() =>
|
|
914
|
+
proposedStep && proposedStepLabel
|
|
915
|
+
? new Map<string, string>([
|
|
916
|
+
[emphasisKey(proposedStep.trailId, proposedStep.step), proposedStepLabel],
|
|
917
|
+
])
|
|
918
|
+
: undefined,
|
|
919
|
+
[proposedStep, proposedStepLabel],
|
|
920
|
+
);
|
|
921
|
+
const panelStepNumberLabels = useMemo(() => {
|
|
922
|
+
if (!hostStepNumberLabels) return proposedStepNumberLabels;
|
|
923
|
+
if (!proposedStepNumberLabels) return hostStepNumberLabels;
|
|
924
|
+
return new Map([...proposedStepNumberLabels, ...hostStepNumberLabels]);
|
|
925
|
+
}, [hostStepNumberLabels, proposedStepNumberLabels]);
|
|
926
|
+
const ghostEdgeIds = useMemo(() => {
|
|
927
|
+
const ids = new Set<string>();
|
|
928
|
+
for (const links of ghostLinksByTrail.values()) {
|
|
929
|
+
for (const link of links) ids.add(trailStepGraphEdgeId(link.previous));
|
|
930
|
+
}
|
|
931
|
+
return ids;
|
|
932
|
+
}, [ghostLinksByTrail]);
|
|
933
|
+
// Both accepted history and a staged proposal join the layout and the camera
|
|
934
|
+
// bounds. The sidebar still renders only the live `trails` prop.
|
|
935
|
+
const linkedEdgeIdsByTrail = useMemo(() => {
|
|
936
|
+
const map = new Map<string, Set<string>>();
|
|
937
|
+
const add = (trailId: string, id: string) => {
|
|
938
|
+
const ids = map.get(trailId) ?? new Set<string>();
|
|
939
|
+
ids.add(id);
|
|
940
|
+
map.set(trailId, ids);
|
|
941
|
+
};
|
|
942
|
+
for (const [trailId, links] of ghostLinksByTrail) {
|
|
943
|
+
for (const link of links) add(trailId, trailStepGraphEdgeId(link.previous));
|
|
944
|
+
}
|
|
945
|
+
if (proposedStep) {
|
|
946
|
+
if (proposedEdgeId) add(proposedStep.trailId, proposedEdgeId);
|
|
947
|
+
// The step being varied stays in focus beside its staged replacement,
|
|
948
|
+
// whichever of the two the guide currently points at.
|
|
949
|
+
const sourceStep = trails
|
|
950
|
+
?.find((t) => t.id === proposedStep.trailId)
|
|
951
|
+
?.steps[proposedStep.stepIndex];
|
|
952
|
+
if (sourceStep) add(proposedStep.trailId, trailStepGraphEdgeId(sourceStep));
|
|
953
|
+
}
|
|
954
|
+
return map;
|
|
955
|
+
}, [ghostLinksByTrail, proposedStep, proposedEdgeId, trails]);
|
|
956
|
+
const layoutTrails = useMemo(() => {
|
|
957
|
+
let merged = trails ?? [];
|
|
958
|
+
if (stepHistory?.length) {
|
|
959
|
+
merged = merged.map((tl) => {
|
|
960
|
+
const links = ghostLinksByTrail.get(tl.id);
|
|
961
|
+
if (!links?.length) return tl;
|
|
962
|
+
const steps = [...tl.steps];
|
|
963
|
+
// Descending order keeps earlier original indices stable when several
|
|
964
|
+
// steps of one trail were changed or removed in the same proposal.
|
|
965
|
+
for (const link of [...links].sort((a, b) => b.stepIndex - a.stepIndex)) {
|
|
966
|
+
// The accepted variation can already be a live row beside its
|
|
967
|
+
// original; never duplicate the previous step in the layout.
|
|
968
|
+
const previousKey = trailStepGraphEdgeId(link.previous);
|
|
969
|
+
if (steps.some((step) => trailStepGraphEdgeId(step) === previousKey)) {
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
const at =
|
|
973
|
+
link.kind === 'changed'
|
|
974
|
+
? Math.min(link.stepIndex + 1, steps.length)
|
|
975
|
+
: Math.min(link.stepIndex, steps.length);
|
|
976
|
+
steps.splice(at, 0, link.previous);
|
|
977
|
+
}
|
|
978
|
+
return { ...tl, steps };
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
if (proposedStep) {
|
|
982
|
+
merged = merged.map((tl) => {
|
|
983
|
+
if (tl.id !== proposedStep.trailId) return tl;
|
|
984
|
+
const steps = [...tl.steps];
|
|
985
|
+
steps.splice(Math.min(proposedStep.stepIndex + 1, steps.length), 0, proposedStep.step);
|
|
986
|
+
return { ...tl, steps };
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
return merged;
|
|
990
|
+
}, [trails, stepHistory, ghostLinksByTrail, proposedStep]);
|
|
991
|
+
// Every step in a host-declared variation group stays in the focused set,
|
|
992
|
+
// even though the guide only names one of them as its active step. Indexes
|
|
993
|
+
// are resolved against `layoutTrails`, which also carries the staged step.
|
|
994
|
+
const variationEdgeIdsByTrail = useMemo(() => {
|
|
995
|
+
const map = new Map<string, Set<string>>();
|
|
996
|
+
if (!focusedVariationStepIndexes) return map;
|
|
997
|
+
for (const [trailId, indexes] of focusedVariationStepIndexes) {
|
|
998
|
+
const tl = layoutTrails.find((t) => t.id === trailId);
|
|
999
|
+
if (!tl) continue;
|
|
1000
|
+
const ids = new Set<string>();
|
|
1001
|
+
for (const index of indexes) {
|
|
1002
|
+
const step = tl.steps[index];
|
|
1003
|
+
if (step) ids.add(trailStepGraphEdgeId(step));
|
|
1004
|
+
}
|
|
1005
|
+
if (ids.size > 0) map.set(trailId, ids);
|
|
1006
|
+
}
|
|
1007
|
+
return map;
|
|
1008
|
+
}, [focusedVariationStepIndexes, layoutTrails]);
|
|
843
1009
|
const graphEdges = useMemo(
|
|
844
|
-
() => deriveGraphEdges({ trails }),
|
|
845
|
-
[
|
|
1010
|
+
() => deriveGraphEdges({ trails: layoutTrails }),
|
|
1011
|
+
[layoutTrails],
|
|
846
1012
|
);
|
|
847
1013
|
const [built, setBuilt] = useState<{
|
|
848
1014
|
nodes: Node[];
|
|
@@ -985,9 +1151,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
985
1151
|
/** A host-driven step focus owns the camera across frame-layout flips. */
|
|
986
1152
|
const stepFocusActiveRef = useRef(false);
|
|
987
1153
|
const focusEdgeIdsRef = useRef<ReadonlySet<string> | null>(null);
|
|
988
|
-
const fitFocusBoundsRef = useRef<(ids: ReadonlySet<string>) => void>(
|
|
989
|
-
() => {},
|
|
990
|
-
);
|
|
1154
|
+
const fitFocusBoundsRef = useRef<(ids: ReadonlySet<string>) => void>(() => {});
|
|
991
1155
|
|
|
992
1156
|
/** Solo layout: only this trail's components and edges are laid out. */
|
|
993
1157
|
const [layoutTrailId, setLayoutTrailId] = useState<string | null>(null);
|
|
@@ -1164,13 +1328,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1164
1328
|
// Keyed on `built` as well as `layoutReady`: whichever of the two passes
|
|
1165
1329
|
// lands last is the one that has the final positions.
|
|
1166
1330
|
useEffect(() => {
|
|
1167
|
-
if (!layoutReady
|
|
1331
|
+
if (!layoutReady) return;
|
|
1332
|
+
// A staged proposal changes the graph's content without changing the
|
|
1333
|
+
// layout flip keys, so the camera must re-fit whenever the new layout
|
|
1334
|
+
// lands — not only for an animated direction/frame flip. While a step is
|
|
1335
|
+
// focused, its edge group owns the camera; never fall back to a
|
|
1336
|
+
// whole-graph fit here.
|
|
1337
|
+
const shouldRefitFocus = focusEdgeIdsRef.current != null;
|
|
1338
|
+
const shouldRefitGraph = refitAfterLayoutRef.current;
|
|
1168
1339
|
refitAfterLayoutRef.current = false;
|
|
1340
|
+
if (!shouldRefitFocus && !shouldRefitGraph) return;
|
|
1169
1341
|
requestAnimationFrame(() => {
|
|
1170
|
-
|
|
1171
|
-
// opened a different trail's frames) must not be replaced by a
|
|
1172
|
-
// whole-graph fit — that would zoom back out to the entire model.
|
|
1173
|
-
if (focusEdgeIdsRef.current) {
|
|
1342
|
+
if (shouldRefitFocus && focusEdgeIdsRef.current) {
|
|
1174
1343
|
fitFocusBoundsRef.current(focusEdgeIdsRef.current);
|
|
1175
1344
|
} else {
|
|
1176
1345
|
fitGraphContents(LAYOUT_FLIP_NODE_MS);
|
|
@@ -1442,8 +1611,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1442
1611
|
// COMMITTED trail, not the requested one, so the swap happens behind the
|
|
1443
1612
|
// edge fade like every other layout flip.
|
|
1444
1613
|
const layoutDoc = useMemo(() => {
|
|
1445
|
-
if (!committedTrailId) return { components, trails };
|
|
1446
|
-
const trail = (
|
|
1614
|
+
if (!committedTrailId) return { components, trails: layoutTrails };
|
|
1615
|
+
const trail = (layoutTrails ?? []).find((t) => t.id === committedTrailId);
|
|
1447
1616
|
if (!trail) return { components, trails };
|
|
1448
1617
|
// Host-local removal ghosts stay in the layout even when their steps are
|
|
1449
1618
|
// gone; otherwise accepting a removal would make the node vanish from a
|
|
@@ -1457,7 +1626,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1457
1626
|
components: components.filter((c) => aliases.has(c.alias)),
|
|
1458
1627
|
trails: [trail],
|
|
1459
1628
|
};
|
|
1460
|
-
}, [components,
|
|
1629
|
+
}, [components, layoutTrails, committedTrailId, removedComponentAliases]);
|
|
1461
1630
|
const layoutRelations = committedTrailId ? undefined : graphifyRelations;
|
|
1462
1631
|
|
|
1463
1632
|
const layoutKey = useMemo(
|
|
@@ -1954,26 +2123,44 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1954
2123
|
// Edge ids in trail focus (an active flow's edge set, or a single
|
|
1955
2124
|
// step's edge). Used to frame the camera. `null` = no trail focus.
|
|
1956
2125
|
const focusEdgeIds = useMemo(() => {
|
|
2126
|
+
const withLinked = (trailId: string, ids: Set<string>) => {
|
|
2127
|
+
for (const id of linkedEdgeIdsByTrail.get(trailId) ?? []) ids.add(id);
|
|
2128
|
+
// All variations of the focused step are one focus group: the camera and
|
|
2129
|
+
// dimming must treat them as a single set, not just the active step.
|
|
2130
|
+
for (const id of variationEdgeIdsByTrail.get(trailId) ?? []) ids.add(id);
|
|
2131
|
+
return ids;
|
|
2132
|
+
};
|
|
1957
2133
|
if (autoPlayFocus) {
|
|
1958
2134
|
const tl = trails?.find((t) => t.id === autoPlayFocus.trailId);
|
|
1959
2135
|
const step = tl?.steps[autoPlayFocus.stepIndex];
|
|
1960
|
-
return step
|
|
2136
|
+
return step
|
|
2137
|
+
? withLinked(autoPlayFocus.trailId, new Set([trailStepGraphEdgeId(step)]))
|
|
2138
|
+
: null;
|
|
1961
2139
|
}
|
|
1962
|
-
if (focusedTrailId == null
|
|
1963
|
-
|
|
2140
|
+
if (focusedTrailId == null) return null;
|
|
2141
|
+
// Host focus indexes can point at a staged step that exists only in the
|
|
2142
|
+
// layout trails, so resolve them there rather than in the live `trails`.
|
|
2143
|
+
const tl = layoutTrails.find((t) => t.id === focusedTrailId);
|
|
1964
2144
|
if (!tl) return null;
|
|
1965
2145
|
if (focusedStepIndex != null) {
|
|
1966
2146
|
const step = tl.steps[focusedStepIndex];
|
|
1967
|
-
return step
|
|
2147
|
+
return step
|
|
2148
|
+
? withLinked(focusedTrailId, new Set([trailStepGraphEdgeId(step)]))
|
|
2149
|
+
: null;
|
|
1968
2150
|
}
|
|
1969
|
-
return
|
|
1970
|
-
|
|
2151
|
+
return withLinked(
|
|
2152
|
+
focusedTrailId,
|
|
2153
|
+
new Set(tl.steps.map((s) => trailStepGraphEdgeId(s))),
|
|
2154
|
+
);
|
|
2155
|
+
}, [trails, layoutTrails, focusedTrailId, focusedStepIndex, autoPlayFocus, linkedEdgeIdsByTrail, variationEdgeIdsByTrail]);
|
|
1971
2156
|
|
|
1972
2157
|
// Keep these refs current during render, not in a later effect: the
|
|
1973
2158
|
// post-layout refit effect is declared above and must see the focus that
|
|
1974
2159
|
// triggered this layout swap, or it falls back to a whole-graph fit.
|
|
1975
2160
|
stepFocusActiveRef.current =
|
|
1976
|
-
autoPlayFocus == null &&
|
|
2161
|
+
autoPlayFocus == null &&
|
|
2162
|
+
focusedTrailId != null &&
|
|
2163
|
+
focusedStepIndex != null;
|
|
1977
2164
|
focusEdgeIdsRef.current = focusEdgeIds;
|
|
1978
2165
|
|
|
1979
2166
|
// 1-based step numbers per edge of the active flow (focused or
|
|
@@ -1999,9 +2186,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1999
2186
|
for (const tl of trails) {
|
|
2000
2187
|
if (!expandedTrails.has(tl.id)) continue;
|
|
2001
2188
|
for (const s of tl.steps) ids.add(trailStepGraphEdgeId(s));
|
|
2189
|
+
for (const id of linkedEdgeIdsByTrail.get(tl.id) ?? []) ids.add(id);
|
|
2002
2190
|
}
|
|
2003
2191
|
return ids.size > 0 ? ids : null;
|
|
2004
|
-
}, [trails, expandedTrails]);
|
|
2192
|
+
}, [trails, expandedTrails, linkedEdgeIdsByTrail]);
|
|
2005
2193
|
|
|
2006
2194
|
const endpointsOf = (edgeIds: ReadonlySet<string> | null): Set<string> | null => {
|
|
2007
2195
|
if (!edgeIds) return null;
|
|
@@ -2018,12 +2206,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2018
2206
|
if (!hoveredTrailStep || !trails) return null;
|
|
2019
2207
|
const tl = trails.find((t) => t.id === hoveredTrailStep.trailId);
|
|
2020
2208
|
if (!tl) return null;
|
|
2209
|
+
const ghosts = linkedEdgeIdsByTrail.get(hoveredTrailStep.trailId) ?? [];
|
|
2021
2210
|
if (hoveredTrailStep.stepIndex == null) {
|
|
2022
|
-
return new Set(
|
|
2211
|
+
return new Set([
|
|
2212
|
+
...tl.steps.map((s) => trailStepGraphEdgeId(s)),
|
|
2213
|
+
...ghosts,
|
|
2214
|
+
]);
|
|
2023
2215
|
}
|
|
2024
2216
|
const step = tl.steps[hoveredTrailStep.stepIndex];
|
|
2025
|
-
return step
|
|
2026
|
-
|
|
2217
|
+
return step
|
|
2218
|
+
? new Set([trailStepGraphEdgeId(step), ...ghosts])
|
|
2219
|
+
: null;
|
|
2220
|
+
}, [trails, hoveredTrailStep, linkedEdgeIdsByTrail]);
|
|
2027
2221
|
// While hovering with a *step* already selected, brighten the union of
|
|
2028
2222
|
// selected + hovered participants. Whole-flow focus (or no focus) keeps
|
|
2029
2223
|
// the old hover-replace preview so a step hover still dims the rest.
|
|
@@ -2225,15 +2419,22 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2225
2419
|
);
|
|
2226
2420
|
|
|
2227
2421
|
const dispEdges = useMemo(() => {
|
|
2228
|
-
const paint = (e: Edge, dimmed: boolean): Edge => {
|
|
2422
|
+
const paint = (e: Edge, dimmed: boolean, proposed: boolean): Edge => {
|
|
2229
2423
|
const markerEnd = e.markerEnd;
|
|
2230
2424
|
const nextMarker =
|
|
2231
|
-
|
|
2232
|
-
? {
|
|
2425
|
+
markerEnd && typeof markerEnd === 'object' && typeof markerEnd.color === 'string'
|
|
2426
|
+
? {
|
|
2427
|
+
...markerEnd,
|
|
2428
|
+
color: proposed
|
|
2429
|
+
? HOST_PROPOSAL_COLOR
|
|
2430
|
+
: dimmed
|
|
2431
|
+
? hexWithAlpha(markerEnd.color, EDGE_DIM_ALPHA)
|
|
2432
|
+
: markerEnd.color,
|
|
2433
|
+
}
|
|
2233
2434
|
: markerEnd;
|
|
2234
2435
|
return {
|
|
2235
2436
|
...e,
|
|
2236
|
-
data: { ...(e.data as object), dimmed },
|
|
2437
|
+
data: { ...(e.data as object), dimmed, proposed },
|
|
2237
2438
|
markerEnd: nextMarker,
|
|
2238
2439
|
};
|
|
2239
2440
|
};
|
|
@@ -2254,6 +2455,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2254
2455
|
set != null && edgeMatches(set, e);
|
|
2255
2456
|
if (openedEdgeIds || focusEdgeIds || previewEdgeIds || issueFocusEdgeIds) {
|
|
2256
2457
|
return baseEdges.map((e) => {
|
|
2458
|
+
const ghost = ghostEdgeIds.has(e.id);
|
|
2459
|
+
const proposed = !ghost && proposedEdgeIds.has(e.id);
|
|
2257
2460
|
const vis = flowElementVisibility({
|
|
2258
2461
|
inOpened: inSet(openedEdgeIds, e),
|
|
2259
2462
|
inSelected: inSet(focusEdgeIds, e),
|
|
@@ -2261,19 +2464,39 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2261
2464
|
anySelected: focusEdgeIds != null,
|
|
2262
2465
|
});
|
|
2263
2466
|
const dimSource = previewEdgeIds ?? issueFocusEdgeIds;
|
|
2264
|
-
const dimmed = dimSource
|
|
2467
|
+
const dimmed = dimSource
|
|
2468
|
+
? vis.hidden || !inSet(dimSource, e)
|
|
2469
|
+
: vis.dimmed || ghost;
|
|
2265
2470
|
const hidden = vis.hidden || !edgeInView(e);
|
|
2266
|
-
return {
|
|
2471
|
+
return {
|
|
2472
|
+
...paint(e, dimmed, proposed),
|
|
2473
|
+
data: { ...(e.data as object), dimmed, ghost, proposed },
|
|
2474
|
+
hidden,
|
|
2475
|
+
};
|
|
2267
2476
|
});
|
|
2268
2477
|
}
|
|
2269
2478
|
if (selectedEdgeId) {
|
|
2270
|
-
return baseEdges.map((e) =>
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2479
|
+
return baseEdges.map((e) => {
|
|
2480
|
+
const ghost = ghostEdgeIds.has(e.id);
|
|
2481
|
+
const proposed = !ghost && proposedEdgeIds.has(e.id);
|
|
2482
|
+
const dimmed = e.id !== selectedEdgeId || ghost;
|
|
2483
|
+
return {
|
|
2484
|
+
...paint(e, dimmed, proposed),
|
|
2485
|
+
data: { ...(e.data as object), dimmed, ghost, proposed },
|
|
2486
|
+
hidden: !edgeInView(e),
|
|
2487
|
+
};
|
|
2488
|
+
});
|
|
2274
2489
|
}
|
|
2275
|
-
return baseEdges.map((e) =>
|
|
2276
|
-
|
|
2490
|
+
return baseEdges.map((e) => {
|
|
2491
|
+
const ghost = ghostEdgeIds.has(e.id);
|
|
2492
|
+
const proposed = !ghost && proposedEdgeIds.has(e.id);
|
|
2493
|
+
return {
|
|
2494
|
+
...paint(e, ghost, proposed),
|
|
2495
|
+
data: { ...(e.data as object), dimmed: ghost, ghost, proposed },
|
|
2496
|
+
hidden: !edgeInView(e),
|
|
2497
|
+
};
|
|
2498
|
+
});
|
|
2499
|
+
}, [baseEdges, selectedEdgeId, openedEdgeIds, focusEdgeIds, previewEdgeIds, issueFocusEdgeIds, resolvedEdgeView, ghostEdgeIds, proposedEdgeIds]);
|
|
2277
2500
|
|
|
2278
2501
|
// Gated on layoutReady so the pre-reveal Pass 1 swap never flashes a count.
|
|
2279
2502
|
const unroutedIds = useMemo(
|
|
@@ -2726,7 +2949,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2726
2949
|
setFocusedStepIndex(null);
|
|
2727
2950
|
setFocusedTrailId(tl.id);
|
|
2728
2951
|
onTrailSelect?.({ trailId: tl.id });
|
|
2729
|
-
const edgeIds = new Set(
|
|
2952
|
+
const edgeIds = new Set([
|
|
2953
|
+
...tl.steps.map((s) => trailStepGraphEdgeId(s)),
|
|
2954
|
+
...(linkedEdgeIdsByTrail.get(tl.id) ?? []),
|
|
2955
|
+
]);
|
|
2730
2956
|
const drawerWillClose =
|
|
2731
2957
|
drawerOpenRef.current && (closeFile || drawerTarget?.kind === 'trail');
|
|
2732
2958
|
setDrawerTarget((prev) =>
|
|
@@ -2753,6 +2979,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2753
2979
|
onTrailSelect,
|
|
2754
2980
|
onSidebarTrailChange,
|
|
2755
2981
|
drawerTarget,
|
|
2982
|
+
linkedEdgeIdsByTrail,
|
|
2756
2983
|
],
|
|
2757
2984
|
);
|
|
2758
2985
|
|
|
@@ -2801,11 +3028,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2801
3028
|
|
|
2802
3029
|
// Focus a single step's edge on the canvas and open/scroll the trail
|
|
2803
3030
|
// drawer to that step's snippet. Clicking the already-focused step clears
|
|
2804
|
-
// step focus and returns to whole-flow (high-level) framing.
|
|
3031
|
+
// step focus and returns to whole-flow (high-level) framing. Host-driven
|
|
3032
|
+
// re-fits pass `allowToggle: false` so a newly linked before/after edge
|
|
3033
|
+
// cannot be mistaken for a second click on the same step.
|
|
2805
3034
|
// In `dim` mode: only dim non-participants (same as hovering a step) —
|
|
2806
3035
|
// no camera move, no drawer, no hide.
|
|
2807
3036
|
const focusTrailStep = useCallback(
|
|
2808
|
-
(
|
|
3037
|
+
(
|
|
3038
|
+
tl: SubsystemTrail,
|
|
3039
|
+
stepIndex: number,
|
|
3040
|
+
showFile = true,
|
|
3041
|
+
options?: { allowToggle?: boolean },
|
|
3042
|
+
) => {
|
|
2809
3043
|
const step = tl.steps[stepIndex];
|
|
2810
3044
|
if (!step) return;
|
|
2811
3045
|
setSelected(null);
|
|
@@ -2825,7 +3059,11 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2825
3059
|
setLayoutTrailId(tl.id);
|
|
2826
3060
|
// Toggle: clicking the selected step unselects it (back to whole flow).
|
|
2827
3061
|
onSidebarTrailChange(tl.id);
|
|
2828
|
-
if (
|
|
3062
|
+
if (
|
|
3063
|
+
(options?.allowToggle ?? true) &&
|
|
3064
|
+
focusedTrailId === tl.id &&
|
|
3065
|
+
focusedStepIndex === stepIndex
|
|
3066
|
+
) {
|
|
2829
3067
|
setFocusedStepIndex(null);
|
|
2830
3068
|
// Pointer is still over the row — keep hover preview so dimming doesn't
|
|
2831
3069
|
// flash off until mouseleave.
|
|
@@ -2837,7 +3075,13 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2837
3075
|
window.clearTimeout(pendingFocusFitRef.current);
|
|
2838
3076
|
pendingFocusFitRef.current = null;
|
|
2839
3077
|
}
|
|
2840
|
-
fitFocusBounds(
|
|
3078
|
+
fitFocusBounds(
|
|
3079
|
+
new Set([
|
|
3080
|
+
...tl.steps.map((s) => trailStepGraphEdgeId(s)),
|
|
3081
|
+
...(linkedEdgeIdsByTrail.get(tl.id) ?? []),
|
|
3082
|
+
...(variationEdgeIdsByTrail.get(tl.id) ?? []),
|
|
3083
|
+
]),
|
|
3084
|
+
);
|
|
2841
3085
|
return;
|
|
2842
3086
|
}
|
|
2843
3087
|
setFocusedStepIndex(stepIndex);
|
|
@@ -2863,7 +3107,11 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2863
3107
|
endLine: step.span?.endLine,
|
|
2864
3108
|
});
|
|
2865
3109
|
}
|
|
2866
|
-
const edgeIds = new Set([
|
|
3110
|
+
const edgeIds = new Set([
|
|
3111
|
+
trailStepGraphEdgeId(step),
|
|
3112
|
+
...(linkedEdgeIdsByTrail.get(tl.id) ?? []),
|
|
3113
|
+
...(variationEdgeIdsByTrail.get(tl.id) ?? []),
|
|
3114
|
+
]);
|
|
2867
3115
|
if (pendingFocusFitRef.current != null) {
|
|
2868
3116
|
window.clearTimeout(pendingFocusFitRef.current);
|
|
2869
3117
|
pendingFocusFitRef.current = null;
|
|
@@ -2885,6 +3133,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2885
3133
|
trailStepMode,
|
|
2886
3134
|
onTrailSelect,
|
|
2887
3135
|
onSidebarTrailChange,
|
|
3136
|
+
linkedEdgeIdsByTrail,
|
|
3137
|
+
variationEdgeIdsByTrail,
|
|
2888
3138
|
],
|
|
2889
3139
|
);
|
|
2890
3140
|
|
|
@@ -2904,17 +3154,31 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2904
3154
|
}
|
|
2905
3155
|
const { trailId, stepIndex } = focusedTrailStep;
|
|
2906
3156
|
const showFile = focusedTrailStep.showFile ?? stepIndex != null;
|
|
2907
|
-
|
|
3157
|
+
// A step's before/after links can arrive after the step itself (an agent
|
|
3158
|
+
// proposes, then commits). Include them in the key so the same focus is
|
|
3159
|
+
// re-fit when the staged or previous state joins the layout.
|
|
3160
|
+
const linkedKey = Array.from(linkedEdgeIdsByTrail.get(trailId) ?? [])
|
|
3161
|
+
.sort()
|
|
3162
|
+
.join(',');
|
|
3163
|
+
const variationKey = Array.from(
|
|
3164
|
+
focusedVariationStepIndexes?.get(trailId) ?? [],
|
|
3165
|
+
)
|
|
3166
|
+
.sort((a, b) => a - b)
|
|
3167
|
+
.join(',');
|
|
3168
|
+
const key = `${trailId}:${stepIndex ?? 'trail'}:${showFile ? 'file' : 'nofile'}:${linkedKey}:${variationKey}`;
|
|
2908
3169
|
if (appliedFocusedTrailStepRef.current === key) return;
|
|
2909
3170
|
if (!layoutReady || !trails?.length) return;
|
|
2910
|
-
|
|
3171
|
+
// A guide step may point at a staged variation that only exists in the
|
|
3172
|
+
// layout trails; resolve focus there so it never silently falls back to
|
|
3173
|
+
// the step it replaces.
|
|
3174
|
+
const tl = layoutTrails.find((t) => t.id === trailId);
|
|
2911
3175
|
if (!tl) return;
|
|
2912
3176
|
if (stepIndex != null && !tl.steps[stepIndex]) return;
|
|
2913
3177
|
appliedFocusedTrailStepRef.current = key;
|
|
2914
3178
|
if (stepIndex == null) {
|
|
2915
3179
|
focusTrailEdges(tl, !showFile);
|
|
2916
3180
|
} else {
|
|
2917
|
-
focusTrailStep(tl, stepIndex, showFile);
|
|
3181
|
+
focusTrailStep(tl, stepIndex, showFile, { allowToggle: false });
|
|
2918
3182
|
}
|
|
2919
3183
|
}, [
|
|
2920
3184
|
focusedTrailStep,
|
|
@@ -2923,6 +3187,9 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2923
3187
|
focusTrailEdges,
|
|
2924
3188
|
focusTrailStep,
|
|
2925
3189
|
clearTrailFocus,
|
|
3190
|
+
linkedEdgeIdsByTrail,
|
|
3191
|
+
focusedVariationStepIndexes,
|
|
3192
|
+
layoutTrails,
|
|
2926
3193
|
]);
|
|
2927
3194
|
|
|
2928
3195
|
useEffect(() => {
|
|
@@ -3321,14 +3588,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3321
3588
|
const labels = dispEdges
|
|
3322
3589
|
.filter((e) => {
|
|
3323
3590
|
if (e.hidden) return false;
|
|
3324
|
-
const d = e?.data as
|
|
3325
|
-
|
|
3591
|
+
const d = e?.data as
|
|
3592
|
+
| { dimmed?: boolean; ghost?: boolean; proposed?: boolean }
|
|
3593
|
+
| undefined;
|
|
3594
|
+
return !d?.dimmed || d?.ghost || d?.proposed;
|
|
3326
3595
|
})
|
|
3327
3596
|
.map((e) => {
|
|
3328
3597
|
const d = e.data as {
|
|
3329
3598
|
mechanism?: string;
|
|
3330
3599
|
provenance?: SubsystemEdgeProvenance;
|
|
3331
3600
|
dimmed?: boolean;
|
|
3601
|
+
ghost?: boolean;
|
|
3602
|
+
proposed?: boolean;
|
|
3332
3603
|
labelX?: number;
|
|
3333
3604
|
labelY?: number;
|
|
3334
3605
|
pathLength?: number;
|
|
@@ -3339,6 +3610,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3339
3610
|
mechanism: d?.mechanism ?? 'uses',
|
|
3340
3611
|
provenance: d?.provenance,
|
|
3341
3612
|
dimmed: d?.dimmed === true,
|
|
3613
|
+
ghost: d?.ghost === true,
|
|
3614
|
+
proposed: d?.proposed === true,
|
|
3342
3615
|
midX: d?.labelX ?? 0,
|
|
3343
3616
|
midY: d?.labelY ?? 0,
|
|
3344
3617
|
pathLength: d?.pathLength ?? 0,
|
|
@@ -3447,6 +3720,24 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3447
3720
|
}}
|
|
3448
3721
|
/>
|
|
3449
3722
|
) : null;
|
|
3723
|
+
// The staged variation is a graph-layout row only. In the panel it has no
|
|
3724
|
+
// row, so its index would highlight the next real step instead.
|
|
3725
|
+
const panelFocusedVariationStepIndexes = useMemo(() => {
|
|
3726
|
+
if (!focusedVariationStepIndexes || !proposedStep) {
|
|
3727
|
+
return focusedVariationStepIndexes;
|
|
3728
|
+
}
|
|
3729
|
+
const stagedIndex = proposedStep.stepIndex + 1;
|
|
3730
|
+
const map = new Map<string, ReadonlySet<number>>();
|
|
3731
|
+
for (const [trailId, indexes] of focusedVariationStepIndexes) {
|
|
3732
|
+
const panelIndexes = new Set(
|
|
3733
|
+
[...indexes].filter(
|
|
3734
|
+
(index) => trailId !== proposedStep.trailId || index !== stagedIndex,
|
|
3735
|
+
),
|
|
3736
|
+
);
|
|
3737
|
+
if (panelIndexes.size) map.set(trailId, panelIndexes);
|
|
3738
|
+
}
|
|
3739
|
+
return map;
|
|
3740
|
+
}, [focusedVariationStepIndexes, proposedStep]);
|
|
3450
3741
|
const trailNavigation = trails && trails.length > 0 ? (
|
|
3451
3742
|
<TrailsPanel
|
|
3452
3743
|
drilldown={trailStepMode !== 'dim'}
|
|
@@ -3456,9 +3747,9 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3456
3747
|
focusedStepIndex={!sidebarTrail || focusedTrailId === sidebarTrail.id ? focusedStepIndex : null}
|
|
3457
3748
|
proposedTrailIds={proposedTrailIds}
|
|
3458
3749
|
proposedStepKeys={proposedStepKeys}
|
|
3750
|
+
focusedVariationStepIndexes={panelFocusedVariationStepIndexes}
|
|
3751
|
+
stepNumberLabels={panelStepNumberLabels}
|
|
3459
3752
|
stepChange={stepChange}
|
|
3460
|
-
showPreviousStep={showPreviousStep}
|
|
3461
|
-
onTogglePreviousStep={onTogglePreviousStep}
|
|
3462
3753
|
detailContent={sidebarPanel}
|
|
3463
3754
|
hoveredTrailStep={hoveredTrailStep}
|
|
3464
3755
|
onToggleCollapsed={toggleTrailCollapsed}
|
|
@@ -3597,7 +3888,9 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3597
3888
|
{edgeLabels.map((lbl) => {
|
|
3598
3889
|
const mechanism = lbl.mechanism;
|
|
3599
3890
|
const isGraphify = lbl.provenance === 'graphify';
|
|
3600
|
-
const color =
|
|
3891
|
+
const color = lbl.proposed
|
|
3892
|
+
? HOST_PROPOSAL_COLOR
|
|
3893
|
+
: edgeColor({ mechanism, provenance: lbl.provenance });
|
|
3601
3894
|
// Label chrome stays the crisp rounded box for every edge — graphify
|
|
3602
3895
|
// provenance is carried by hue (GRAPHIFY_RELATION_COLOR), the dashed
|
|
3603
3896
|
// stroke, and the tooltip, NOT by the "ambiguous" cloud silhouette
|
|
@@ -3610,9 +3903,13 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3610
3903
|
: undefined;
|
|
3611
3904
|
const screenX = lbl.midX * viewport.zoom + viewport.x;
|
|
3612
3905
|
const screenY = lbl.midY * viewport.zoom + viewport.y;
|
|
3613
|
-
const text = lbl.
|
|
3614
|
-
?
|
|
3615
|
-
: lbl.
|
|
3906
|
+
const text = lbl.ghost
|
|
3907
|
+
? `was ${lbl.mechanism}`
|
|
3908
|
+
: lbl.proposed
|
|
3909
|
+
? `${proposedStepLabel ? `${proposedStepLabel}: ` : ''}${lbl.mechanism}`
|
|
3910
|
+
: lbl.stepNos?.length
|
|
3911
|
+
? `${lbl.stepNos.map((n) => `${n}:`).join(' ')} ${lbl.mechanism}`
|
|
3912
|
+
: lbl.mechanism;
|
|
3616
3913
|
return (
|
|
3617
3914
|
<div
|
|
3618
3915
|
key={lbl.id}
|
|
@@ -3640,7 +3937,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3640
3937
|
padding: '7px 8px',
|
|
3641
3938
|
cursor: 'pointer',
|
|
3642
3939
|
pointerEvents: 'auto',
|
|
3643
|
-
opacity: lbl.dimmed ? 0.15 : 1,
|
|
3940
|
+
opacity: lbl.ghost ? 0.5 : lbl.proposed ? 1 : lbl.dimmed ? 0.15 : 1,
|
|
3644
3941
|
}}
|
|
3645
3942
|
>
|
|
3646
3943
|
{/* Background layer. Opaque theme surface (matches the node fill)
|