@principal-ai/subsystems-react 0.56.34 → 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 +106 -2
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +454 -70
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailStepsNav.d.ts +4 -2
- package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
- package/dist/subsystem/TrailStepsNav.js +14 -4
- package/dist/subsystem/TrailStepsNav.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +18 -2
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +40 -18
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/model.d.ts +27 -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 +149 -153
- 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 +2079 -0
- 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 +960 -0
- package/src/stories/Canvases/Subsystem/Spotlights.stories.tsx +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +609 -70
- package/src/subsystem/TrailStepsNav.tsx +16 -4
- package/src/subsystem/TrailsPanel.tsx +86 -12
- package/src/subsystem/model.test.ts +17 -13
- package/src/subsystem/model.ts +66 -48
- package/src/subsystem/nodeIconography.ts +88 -0
- package/src/subsystem/nodes.component.test.tsx +177 -0
- package/src/subsystem/nodes.tsx +256 -174
- package/src/subsystem/stepEmphasis.ts +8 -0
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
ReactFlow,
|
|
22
22
|
ReactFlowProvider,
|
|
23
23
|
useReactFlow,
|
|
24
|
+
useStore,
|
|
24
25
|
useViewport,
|
|
26
|
+
getViewportForBounds,
|
|
25
27
|
type NodeTypes,
|
|
26
28
|
type EdgeTypes,
|
|
27
29
|
type Node,
|
|
@@ -47,6 +49,7 @@ import {
|
|
|
47
49
|
processGroupNodeId,
|
|
48
50
|
isTrailMechanism,
|
|
49
51
|
edgeColor,
|
|
52
|
+
HOST_PROPOSAL_COLOR,
|
|
50
53
|
MECHANISM_DESCRIPTIONS,
|
|
51
54
|
subsystemGraphLayoutKey,
|
|
52
55
|
trailStepGraphEdgeId,
|
|
@@ -63,6 +66,7 @@ import {
|
|
|
63
66
|
type SubsystemRegionDetails,
|
|
64
67
|
type SubsystemRegionIssue,
|
|
65
68
|
type SubsystemTrail,
|
|
69
|
+
type SubsystemTrailStep,
|
|
66
70
|
} from './model';
|
|
67
71
|
import { ConstructsCatalog } from './ConstructsCatalog';
|
|
68
72
|
import { ContainersPanel, type ContainerListItem } from './ContainersPanel';
|
|
@@ -103,8 +107,13 @@ import { ShareButton } from './ShareButton';
|
|
|
103
107
|
import { DescriptionOverlay } from './DescriptionOverlay';
|
|
104
108
|
import { DescriptionPreview } from './DescriptionPreview';
|
|
105
109
|
import type { GraphSidebarTab } from './GraphSidebar';
|
|
106
|
-
import {
|
|
107
|
-
|
|
110
|
+
import {
|
|
111
|
+
TrailsPanel,
|
|
112
|
+
TRAIL_PLAY_PAUSE_MS,
|
|
113
|
+
TRAIL_HOVER_PREVIEW_MS,
|
|
114
|
+
type TrailsStepChange,
|
|
115
|
+
} from './TrailsPanel';
|
|
116
|
+
import { emphasisKey, variationStepNumber, type StepEmphasisMap } from './stepEmphasis';
|
|
108
117
|
import {
|
|
109
118
|
EDGE_LABEL_WIDTH,
|
|
110
119
|
EDGE_LABEL_HEIGHT,
|
|
@@ -259,6 +268,34 @@ export interface SubsystemNodeRect {
|
|
|
259
268
|
height: number;
|
|
260
269
|
}
|
|
261
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
|
+
|
|
262
299
|
export interface SubsystemComponentGraphProps {
|
|
263
300
|
components: SubsystemComponent[];
|
|
264
301
|
/**
|
|
@@ -335,6 +372,72 @@ export interface SubsystemComponentGraphProps {
|
|
|
335
372
|
* trail.
|
|
336
373
|
*/
|
|
337
374
|
onTrailSelect?: (ref: { trailId: string; stepIndices?: number[] } | null) => void;
|
|
375
|
+
/**
|
|
376
|
+
* PROTOTYPE: host-controlled trail focus. Changing this expands the trail
|
|
377
|
+
* and drives the camera. With a `stepIndex`, it focuses that step's edge;
|
|
378
|
+
* without one, it frames the whole trail. `showFile` controls whether the
|
|
379
|
+
* step's file/trail drawer opens — omit it for whole-trail focus, or set it
|
|
380
|
+
* to `false` to select a step without showing its file.
|
|
381
|
+
*
|
|
382
|
+
* `undefined` leaves in-graph focus untouched; `null` clears host control.
|
|
383
|
+
*/
|
|
384
|
+
focusedTrailStep?: {
|
|
385
|
+
trailId: string;
|
|
386
|
+
stepIndex?: number;
|
|
387
|
+
showFile?: boolean;
|
|
388
|
+
} | null;
|
|
389
|
+
/**
|
|
390
|
+
* PROTOTYPE: host-local ids of trails awaiting confirmation. Their Trails
|
|
391
|
+
* panel icon uses the proposal color instead of labelling the title.
|
|
392
|
+
*/
|
|
393
|
+
proposedTrailIds?: Set<string>;
|
|
394
|
+
/**
|
|
395
|
+
* PROTOTYPE: host-local ids of steps awaiting confirmation, keyed by
|
|
396
|
+
* `emphasisKey(trailId, step)`. Their Trails panel text uses proposal color.
|
|
397
|
+
*/
|
|
398
|
+
proposedStepKeys?: Set<string>;
|
|
399
|
+
/**
|
|
400
|
+
* PROTOTYPE: host-local before/after view for an accepted step replacement.
|
|
401
|
+
* The previous step keeps its row and its annotation is greyed; the accepted
|
|
402
|
+
* variation stays beside it with its `2a` label.
|
|
403
|
+
*/
|
|
404
|
+
stepChange?: TrailsStepChange | null;
|
|
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>>;
|
|
425
|
+
/**
|
|
426
|
+
* PROTOTYPE: host-local component aliases awaiting confirmation. Their boxes
|
|
427
|
+
* use the proposal border, name colour and `PROPOSED` badge.
|
|
428
|
+
*/
|
|
429
|
+
proposedComponentAliases?: Set<string>;
|
|
430
|
+
/**
|
|
431
|
+
* PROTOTYPE: host-local component aliases the agent is currently working on.
|
|
432
|
+
* Their boxes get a static ring and a sparkling WandSparkles icon.
|
|
433
|
+
*/
|
|
434
|
+
workingComponentAliases?: Set<string>;
|
|
435
|
+
/**
|
|
436
|
+
* PROTOTYPE: host-local component aliases removed from the model. Their
|
|
437
|
+
* nodes stay in the layout, dimmed and `REMOVED`-badged, so the change is
|
|
438
|
+
* legible instead of silently disappearing.
|
|
439
|
+
*/
|
|
440
|
+
removedComponentAliases?: Set<string>;
|
|
338
441
|
/**
|
|
339
442
|
* Reports which trail step is currently hovered in the Trails panel —
|
|
340
443
|
* the transient preview mirror of `onTrailSelect`. `null` when nothing is
|
|
@@ -404,6 +507,11 @@ export interface SubsystemComponentGraphProps {
|
|
|
404
507
|
* subsystem name visible as an overlay on the canvas.
|
|
405
508
|
*/
|
|
406
509
|
hideSidebar?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Suppress only the standard full-width header (title + sidebar-view switch)
|
|
512
|
+
* while keeping the sidebar and canvas. Hosts can render their own header.
|
|
513
|
+
*/
|
|
514
|
+
hideHeader?: boolean;
|
|
407
515
|
/**
|
|
408
516
|
* How trail step highlighting behaves on the canvas.
|
|
409
517
|
* - `focus` (default): zoom to the step, hide non-participants, open drawer
|
|
@@ -435,6 +543,12 @@ export interface SubsystemComponentGraphProps {
|
|
|
435
543
|
* @default 300
|
|
436
544
|
*/
|
|
437
545
|
trailFocusDurationMs?: number;
|
|
546
|
+
/**
|
|
547
|
+
* Downward screen-pixel offset applied when the camera frames the graph or
|
|
548
|
+
* a focused trail step. Useful for hosts with chrome over the canvas top.
|
|
549
|
+
* @default 0
|
|
550
|
+
*/
|
|
551
|
+
focusVerticalBiasPx?: number;
|
|
438
552
|
/**
|
|
439
553
|
* Subsystem title rendered as a non-interactive overlay chip on the graph
|
|
440
554
|
* canvas (top-center). Does not trigger the sidebar — for graph-only
|
|
@@ -749,9 +863,13 @@ interface InnerProps extends SubsystemComponentGraphProps {
|
|
|
749
863
|
onSidebarTrailChange: (trailId: string | null) => void;
|
|
750
864
|
}
|
|
751
865
|
|
|
752
|
-
function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirection: layoutDirectionProp, defaultLayoutDirection = 'horizontal', onLayoutDirectionChange, hideLayoutToggle = false, refocusOnLayoutFlip = true, initialTrailId, onTrailSelect, 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, 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) {
|
|
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) {
|
|
753
867
|
const { theme } = useTheme();
|
|
754
|
-
const { fitView, fitBounds } = useReactFlow();
|
|
868
|
+
const { fitView, fitBounds, setViewport } = useReactFlow();
|
|
869
|
+
const flowWidth = useStore((state) => state.width);
|
|
870
|
+
const flowHeight = useStore((state) => state.height);
|
|
871
|
+
const minZoom = useStore((state) => state.minZoom);
|
|
872
|
+
const maxZoom = useStore((state) => state.maxZoom);
|
|
755
873
|
const [descriptionOpen, setDescriptionOpen] = useState(false);
|
|
756
874
|
const rawDescription = description?.trim();
|
|
757
875
|
// The host caps the authored description; trim defensively for other hosts.
|
|
@@ -768,9 +886,129 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
768
886
|
// Restored once per mount from `localStorage` (see `readViewState`). Each
|
|
769
887
|
// graph is its own tab/mount, so `persistKey` is stable for a mount.
|
|
770
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]);
|
|
771
1009
|
const graphEdges = useMemo(
|
|
772
|
-
() => deriveGraphEdges({ trails }),
|
|
773
|
-
[
|
|
1010
|
+
() => deriveGraphEdges({ trails: layoutTrails }),
|
|
1011
|
+
[layoutTrails],
|
|
774
1012
|
);
|
|
775
1013
|
const [built, setBuilt] = useState<{
|
|
776
1014
|
nodes: Node[];
|
|
@@ -781,6 +1019,47 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
781
1019
|
edges: [],
|
|
782
1020
|
absoluteRects: new Map(),
|
|
783
1021
|
});
|
|
1022
|
+
|
|
1023
|
+
// React Flow's `fitBounds` always centres the bounds. A host may need the
|
|
1024
|
+
// diagram deliberately lower (e.g. to leave room for status chrome over the
|
|
1025
|
+
// canvas), so recompute the same viewport and shift only its screen-space y.
|
|
1026
|
+
const fitBoundsWithBias = useCallback(
|
|
1027
|
+
(
|
|
1028
|
+
bounds: { x: number; y: number; width: number; height: number },
|
|
1029
|
+
options: { padding: number; duration?: number },
|
|
1030
|
+
) => {
|
|
1031
|
+
if (
|
|
1032
|
+
!focusVerticalBiasPx ||
|
|
1033
|
+
flowWidth <= 0 ||
|
|
1034
|
+
flowHeight <= 0
|
|
1035
|
+
) {
|
|
1036
|
+
void fitBounds(bounds, options);
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
const viewport = getViewportForBounds(
|
|
1040
|
+
bounds,
|
|
1041
|
+
flowWidth,
|
|
1042
|
+
flowHeight,
|
|
1043
|
+
minZoom,
|
|
1044
|
+
maxZoom,
|
|
1045
|
+
options.padding,
|
|
1046
|
+
);
|
|
1047
|
+
void setViewport(
|
|
1048
|
+
{ ...viewport, y: viewport.y + focusVerticalBiasPx },
|
|
1049
|
+
{ duration: options.duration },
|
|
1050
|
+
);
|
|
1051
|
+
},
|
|
1052
|
+
[
|
|
1053
|
+
fitBounds,
|
|
1054
|
+
setViewport,
|
|
1055
|
+
flowWidth,
|
|
1056
|
+
flowHeight,
|
|
1057
|
+
minZoom,
|
|
1058
|
+
maxZoom,
|
|
1059
|
+
focusVerticalBiasPx,
|
|
1060
|
+
],
|
|
1061
|
+
);
|
|
1062
|
+
|
|
784
1063
|
const fitGraphContents = useCallback(
|
|
785
1064
|
(duration = 300) => {
|
|
786
1065
|
const edges = built.edges.map((edge) => {
|
|
@@ -814,9 +1093,9 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
814
1093
|
});
|
|
815
1094
|
return;
|
|
816
1095
|
}
|
|
817
|
-
|
|
1096
|
+
fitBoundsWithBias(bounds, { padding: 0.1, duration });
|
|
818
1097
|
},
|
|
819
|
-
[built.absoluteRects, built.edges,
|
|
1098
|
+
[built.absoluteRects, built.edges, fitBoundsWithBias, fitView],
|
|
820
1099
|
);
|
|
821
1100
|
const [layoutReady, setLayoutReady] = useState(false);
|
|
822
1101
|
const transparentCanvas = canvasBackground === 'transparent';
|
|
@@ -869,6 +1148,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
869
1148
|
const flipFadeTimerRef = useRef<number | null>(null);
|
|
870
1149
|
/** Set when a layout flip starts; the camera refits once layout lands. */
|
|
871
1150
|
const refitAfterLayoutRef = useRef(false);
|
|
1151
|
+
/** A host-driven step focus owns the camera across frame-layout flips. */
|
|
1152
|
+
const stepFocusActiveRef = useRef(false);
|
|
1153
|
+
const focusEdgeIdsRef = useRef<ReadonlySet<string> | null>(null);
|
|
1154
|
+
const fitFocusBoundsRef = useRef<(ids: ReadonlySet<string>) => void>(() => {});
|
|
872
1155
|
|
|
873
1156
|
/** Solo layout: only this trail's components and edges are laid out. */
|
|
874
1157
|
const [layoutTrailId, setLayoutTrailId] = useState<string | null>(null);
|
|
@@ -1045,10 +1328,22 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1045
1328
|
// Keyed on `built` as well as `layoutReady`: whichever of the two passes
|
|
1046
1329
|
// lands last is the one that has the final positions.
|
|
1047
1330
|
useEffect(() => {
|
|
1048
|
-
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;
|
|
1049
1339
|
refitAfterLayoutRef.current = false;
|
|
1340
|
+
if (!shouldRefitFocus && !shouldRefitGraph) return;
|
|
1050
1341
|
requestAnimationFrame(() => {
|
|
1051
|
-
|
|
1342
|
+
if (shouldRefitFocus && focusEdgeIdsRef.current) {
|
|
1343
|
+
fitFocusBoundsRef.current(focusEdgeIdsRef.current);
|
|
1344
|
+
} else {
|
|
1345
|
+
fitGraphContents(LAYOUT_FLIP_NODE_MS);
|
|
1346
|
+
}
|
|
1052
1347
|
});
|
|
1053
1348
|
}, [built, layoutReady, fitGraphContents]);
|
|
1054
1349
|
|
|
@@ -1316,10 +1611,13 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1316
1611
|
// COMMITTED trail, not the requested one, so the swap happens behind the
|
|
1317
1612
|
// edge fade like every other layout flip.
|
|
1318
1613
|
const layoutDoc = useMemo(() => {
|
|
1319
|
-
if (!committedTrailId) return { components, trails };
|
|
1320
|
-
const trail = (
|
|
1614
|
+
if (!committedTrailId) return { components, trails: layoutTrails };
|
|
1615
|
+
const trail = (layoutTrails ?? []).find((t) => t.id === committedTrailId);
|
|
1321
1616
|
if (!trail) return { components, trails };
|
|
1322
|
-
|
|
1617
|
+
// Host-local removal ghosts stay in the layout even when their steps are
|
|
1618
|
+
// gone; otherwise accepting a removal would make the node vanish from a
|
|
1619
|
+
// solo-focused flow instead of leaving the dim record the user asked for.
|
|
1620
|
+
const aliases = new Set<string>(removedComponentAliases);
|
|
1323
1621
|
for (const step of trail.steps) {
|
|
1324
1622
|
aliases.add(step.from);
|
|
1325
1623
|
aliases.add(step.to);
|
|
@@ -1328,7 +1626,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1328
1626
|
components: components.filter((c) => aliases.has(c.alias)),
|
|
1329
1627
|
trails: [trail],
|
|
1330
1628
|
};
|
|
1331
|
-
}, [components,
|
|
1629
|
+
}, [components, layoutTrails, committedTrailId, removedComponentAliases]);
|
|
1332
1630
|
const layoutRelations = committedTrailId ? undefined : graphifyRelations;
|
|
1333
1631
|
|
|
1334
1632
|
const layoutKey = useMemo(
|
|
@@ -1824,20 +2122,46 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1824
2122
|
|
|
1825
2123
|
// Edge ids in trail focus (an active flow's edge set, or a single
|
|
1826
2124
|
// step's edge). Used to frame the camera. `null` = no trail focus.
|
|
1827
|
-
const focusEdgeIds = useMemo(() => {
|
|
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
|
+
};
|
|
2133
|
+
if (autoPlayFocus) {
|
|
1828
2134
|
const tl = trails?.find((t) => t.id === autoPlayFocus.trailId);
|
|
1829
2135
|
const step = tl?.steps[autoPlayFocus.stepIndex];
|
|
1830
|
-
return step
|
|
2136
|
+
return step
|
|
2137
|
+
? withLinked(autoPlayFocus.trailId, new Set([trailStepGraphEdgeId(step)]))
|
|
2138
|
+
: null;
|
|
1831
2139
|
}
|
|
1832
|
-
if (focusedTrailId == null
|
|
1833
|
-
|
|
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);
|
|
1834
2144
|
if (!tl) return null;
|
|
1835
2145
|
if (focusedStepIndex != null) {
|
|
1836
2146
|
const step = tl.steps[focusedStepIndex];
|
|
1837
|
-
return step
|
|
2147
|
+
return step
|
|
2148
|
+
? withLinked(focusedTrailId, new Set([trailStepGraphEdgeId(step)]))
|
|
2149
|
+
: null;
|
|
1838
2150
|
}
|
|
1839
|
-
return
|
|
1840
|
-
|
|
2151
|
+
return withLinked(
|
|
2152
|
+
focusedTrailId,
|
|
2153
|
+
new Set(tl.steps.map((s) => trailStepGraphEdgeId(s))),
|
|
2154
|
+
);
|
|
2155
|
+
}, [trails, layoutTrails, focusedTrailId, focusedStepIndex, autoPlayFocus, linkedEdgeIdsByTrail, variationEdgeIdsByTrail]);
|
|
2156
|
+
|
|
2157
|
+
// Keep these refs current during render, not in a later effect: the
|
|
2158
|
+
// post-layout refit effect is declared above and must see the focus that
|
|
2159
|
+
// triggered this layout swap, or it falls back to a whole-graph fit.
|
|
2160
|
+
stepFocusActiveRef.current =
|
|
2161
|
+
autoPlayFocus == null &&
|
|
2162
|
+
focusedTrailId != null &&
|
|
2163
|
+
focusedStepIndex != null;
|
|
2164
|
+
focusEdgeIdsRef.current = focusEdgeIds;
|
|
1841
2165
|
|
|
1842
2166
|
// 1-based step numbers per edge of the active flow (focused or
|
|
1843
2167
|
// hover/autoplay-highlighted). An edge can appear in more than one step.
|
|
@@ -1862,9 +2186,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1862
2186
|
for (const tl of trails) {
|
|
1863
2187
|
if (!expandedTrails.has(tl.id)) continue;
|
|
1864
2188
|
for (const s of tl.steps) ids.add(trailStepGraphEdgeId(s));
|
|
2189
|
+
for (const id of linkedEdgeIdsByTrail.get(tl.id) ?? []) ids.add(id);
|
|
1865
2190
|
}
|
|
1866
2191
|
return ids.size > 0 ? ids : null;
|
|
1867
|
-
}, [trails, expandedTrails]);
|
|
2192
|
+
}, [trails, expandedTrails, linkedEdgeIdsByTrail]);
|
|
1868
2193
|
|
|
1869
2194
|
const endpointsOf = (edgeIds: ReadonlySet<string> | null): Set<string> | null => {
|
|
1870
2195
|
if (!edgeIds) return null;
|
|
@@ -1881,12 +2206,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1881
2206
|
if (!hoveredTrailStep || !trails) return null;
|
|
1882
2207
|
const tl = trails.find((t) => t.id === hoveredTrailStep.trailId);
|
|
1883
2208
|
if (!tl) return null;
|
|
2209
|
+
const ghosts = linkedEdgeIdsByTrail.get(hoveredTrailStep.trailId) ?? [];
|
|
1884
2210
|
if (hoveredTrailStep.stepIndex == null) {
|
|
1885
|
-
return new Set(
|
|
2211
|
+
return new Set([
|
|
2212
|
+
...tl.steps.map((s) => trailStepGraphEdgeId(s)),
|
|
2213
|
+
...ghosts,
|
|
2214
|
+
]);
|
|
1886
2215
|
}
|
|
1887
2216
|
const step = tl.steps[hoveredTrailStep.stepIndex];
|
|
1888
|
-
return step
|
|
1889
|
-
|
|
2217
|
+
return step
|
|
2218
|
+
? new Set([trailStepGraphEdgeId(step), ...ghosts])
|
|
2219
|
+
: null;
|
|
2220
|
+
}, [trails, hoveredTrailStep, linkedEdgeIdsByTrail]);
|
|
1890
2221
|
// While hovering with a *step* already selected, brighten the union of
|
|
1891
2222
|
// selected + hovered participants. Whole-flow focus (or no focus) keeps
|
|
1892
2223
|
// the old hover-replace preview so a step hover still dims the rest.
|
|
@@ -2019,6 +2350,15 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2019
2350
|
};
|
|
2020
2351
|
}
|
|
2021
2352
|
const comp = (n.data as { component?: SubsystemComponent } | undefined)?.component;
|
|
2353
|
+
const proposed =
|
|
2354
|
+
comp?.alias != null &&
|
|
2355
|
+
proposedComponentAliases?.has(comp.alias) === true;
|
|
2356
|
+
const working =
|
|
2357
|
+
comp?.alias != null &&
|
|
2358
|
+
workingComponentAliases?.has(comp.alias) === true;
|
|
2359
|
+
const removed =
|
|
2360
|
+
comp?.alias != null &&
|
|
2361
|
+
removedComponentAliases?.has(comp.alias) === true;
|
|
2022
2362
|
const fileMatch = fileMatchForNode(comp?.file, openFile, focusNodeIds?.has(n.id) === true);
|
|
2023
2363
|
// Bases selection on the focused step, not the hover preview, so
|
|
2024
2364
|
// hovering doesn't strip the frame's `isSelected`.
|
|
@@ -2026,7 +2366,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2026
2366
|
// `brightNodeIds` (the focused step's endpoints) is a spotlight member as
|
|
2027
2367
|
// well as a bright set — see the group branch above.
|
|
2028
2368
|
const dimSource = previewNodeIds ?? brightNodeIds ?? issueFocusNodeIds;
|
|
2029
|
-
const
|
|
2369
|
+
const flowVisibility = flowNodeVisibility({
|
|
2030
2370
|
inOpened: openedNodeIds?.has(n.id) === true,
|
|
2031
2371
|
inSelected: brightNodeIds?.has(n.id) === true,
|
|
2032
2372
|
inSpotlight: dimSource?.has(n.id) === true || (hoverTrailAliases?.has(n.id) === true),
|
|
@@ -2034,13 +2374,25 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2034
2374
|
anySelected: brightNodeIds != null,
|
|
2035
2375
|
anySpotlight: dimSource != null || hoverTrailAliases != null,
|
|
2036
2376
|
});
|
|
2377
|
+
// A removed ghost is never hidden by flow focus — the whole point is to
|
|
2378
|
+
// keep it visible as a dim record of what the agent took out.
|
|
2379
|
+
const hidden = removed ? false : flowVisibility.hidden;
|
|
2380
|
+
const dimmed = removed ? true : flowVisibility.dimmed;
|
|
2037
2381
|
// Component findings key by alias, boundary findings by region node id.
|
|
2038
2382
|
// The two id spaces are disjoint (`module:` / `process:` are prefixed), so
|
|
2039
2383
|
// one lookup covers both node kinds.
|
|
2040
2384
|
const issueBadge =
|
|
2041
2385
|
issueBadgeByAlias.get(n.id) ?? regionIssueByNodeId.get(n.id);
|
|
2042
|
-
if (
|
|
2043
|
-
|
|
2386
|
+
if (
|
|
2387
|
+
fileMatch === undefined &&
|
|
2388
|
+
!isSelected &&
|
|
2389
|
+
!dimmed &&
|
|
2390
|
+
!issueBadge &&
|
|
2391
|
+
!proposed &&
|
|
2392
|
+
!working &&
|
|
2393
|
+
!removed
|
|
2394
|
+
) {
|
|
2395
|
+
const { fileMatch: _f, isSelected: _s, dimmed: _d, proposed: _p, working: _w, removed: _r, ...rest } = n.data as Record<string, unknown>;
|
|
2044
2396
|
return { ...n, hidden, data: rest };
|
|
2045
2397
|
}
|
|
2046
2398
|
return {
|
|
@@ -2051,11 +2403,14 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2051
2403
|
...(fileMatch !== undefined && { fileMatch }),
|
|
2052
2404
|
...(isSelected && { isSelected }),
|
|
2053
2405
|
...(dimmed && { dimmed: true }),
|
|
2406
|
+
...(proposed && { proposed: true }),
|
|
2407
|
+
...(working && { working: true }),
|
|
2408
|
+
...(removed && { removed: true }),
|
|
2054
2409
|
...(issueBadge && { issue: issueBadge }),
|
|
2055
2410
|
},
|
|
2056
2411
|
};
|
|
2057
2412
|
});
|
|
2058
|
-
}, [xyflowNodesBase, openFile, selected, focusNodeIds, openedNodeIds, brightNodeIds, previewNodeIds, hoverTrailAliases, aliasToComponent, issueFocusNodeIds, issueBadgeByAlias, regionIssueByNodeId, boundaryColors, toggleCollapsed]);
|
|
2413
|
+
}, [xyflowNodesBase, openFile, selected, focusNodeIds, openedNodeIds, brightNodeIds, previewNodeIds, hoverTrailAliases, aliasToComponent, issueFocusNodeIds, issueBadgeByAlias, regionIssueByNodeId, boundaryColors, proposedComponentAliases, workingComponentAliases, removedComponentAliases, toggleCollapsed]);
|
|
2059
2414
|
|
|
2060
2415
|
const baseNodesKey = useMemo(() => nodes.map((n) => n.id).sort().join(','), [nodes]);
|
|
2061
2416
|
const baseEdgesKey = useMemo(
|
|
@@ -2064,15 +2419,22 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2064
2419
|
);
|
|
2065
2420
|
|
|
2066
2421
|
const dispEdges = useMemo(() => {
|
|
2067
|
-
const paint = (e: Edge, dimmed: boolean): Edge => {
|
|
2422
|
+
const paint = (e: Edge, dimmed: boolean, proposed: boolean): Edge => {
|
|
2068
2423
|
const markerEnd = e.markerEnd;
|
|
2069
2424
|
const nextMarker =
|
|
2070
|
-
|
|
2071
|
-
? {
|
|
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
|
+
}
|
|
2072
2434
|
: markerEnd;
|
|
2073
2435
|
return {
|
|
2074
2436
|
...e,
|
|
2075
|
-
data: { ...(e.data as object), dimmed },
|
|
2437
|
+
data: { ...(e.data as object), dimmed, proposed },
|
|
2076
2438
|
markerEnd: nextMarker,
|
|
2077
2439
|
};
|
|
2078
2440
|
};
|
|
@@ -2093,6 +2455,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2093
2455
|
set != null && edgeMatches(set, e);
|
|
2094
2456
|
if (openedEdgeIds || focusEdgeIds || previewEdgeIds || issueFocusEdgeIds) {
|
|
2095
2457
|
return baseEdges.map((e) => {
|
|
2458
|
+
const ghost = ghostEdgeIds.has(e.id);
|
|
2459
|
+
const proposed = !ghost && proposedEdgeIds.has(e.id);
|
|
2096
2460
|
const vis = flowElementVisibility({
|
|
2097
2461
|
inOpened: inSet(openedEdgeIds, e),
|
|
2098
2462
|
inSelected: inSet(focusEdgeIds, e),
|
|
@@ -2100,19 +2464,39 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2100
2464
|
anySelected: focusEdgeIds != null,
|
|
2101
2465
|
});
|
|
2102
2466
|
const dimSource = previewEdgeIds ?? issueFocusEdgeIds;
|
|
2103
|
-
const dimmed = dimSource
|
|
2467
|
+
const dimmed = dimSource
|
|
2468
|
+
? vis.hidden || !inSet(dimSource, e)
|
|
2469
|
+
: vis.dimmed || ghost;
|
|
2104
2470
|
const hidden = vis.hidden || !edgeInView(e);
|
|
2105
|
-
return {
|
|
2471
|
+
return {
|
|
2472
|
+
...paint(e, dimmed, proposed),
|
|
2473
|
+
data: { ...(e.data as object), dimmed, ghost, proposed },
|
|
2474
|
+
hidden,
|
|
2475
|
+
};
|
|
2106
2476
|
});
|
|
2107
2477
|
}
|
|
2108
2478
|
if (selectedEdgeId) {
|
|
2109
|
-
return baseEdges.map((e) =>
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
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
|
+
});
|
|
2113
2489
|
}
|
|
2114
|
-
return baseEdges.map((e) =>
|
|
2115
|
-
|
|
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]);
|
|
2116
2500
|
|
|
2117
2501
|
// Gated on layoutReady so the pre-reveal Pass 1 swap never flashes a count.
|
|
2118
2502
|
const unroutedIds = useMemo(
|
|
@@ -2150,8 +2534,9 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2150
2534
|
|
|
2151
2535
|
useEffect(() => {
|
|
2152
2536
|
// A layout flip runs its own camera refit when the new layout lands. This
|
|
2153
|
-
// mount/edit fit would otherwise fire mid-flip and fight it.
|
|
2154
|
-
|
|
2537
|
+
// mount/edit fit would otherwise fire mid-flip and fight it. A focused
|
|
2538
|
+
// step also owns the camera — a frame flip must not restore whole-graph fit.
|
|
2539
|
+
if (layoutFlipping || stepFocusActiveRef.current) return;
|
|
2155
2540
|
const t = setTimeout(() => {
|
|
2156
2541
|
fitGraphContents(200);
|
|
2157
2542
|
}, 200);
|
|
@@ -2390,7 +2775,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2390
2775
|
width: Math.max(1, maxX - minX),
|
|
2391
2776
|
height: Math.max(1, maxY - minY),
|
|
2392
2777
|
};
|
|
2393
|
-
|
|
2778
|
+
fitBoundsWithBias(bounds, {
|
|
2394
2779
|
padding: 0.15,
|
|
2395
2780
|
duration: trailFocusDurationMs,
|
|
2396
2781
|
});
|
|
@@ -2398,12 +2783,16 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2398
2783
|
[
|
|
2399
2784
|
baseEdges,
|
|
2400
2785
|
built.absoluteRects,
|
|
2401
|
-
|
|
2786
|
+
fitBoundsWithBias,
|
|
2402
2787
|
zoomOnTrailFocus,
|
|
2403
2788
|
trailFocusDurationMs,
|
|
2404
2789
|
],
|
|
2405
2790
|
);
|
|
2406
2791
|
|
|
2792
|
+
useEffect(() => {
|
|
2793
|
+
fitFocusBoundsRef.current = fitFocusBounds;
|
|
2794
|
+
}, [fitFocusBounds]);
|
|
2795
|
+
|
|
2407
2796
|
// A node's laid-out rect in absolute flow coords. `absoluteRects` is the
|
|
2408
2797
|
// authority; the fallback covers an unparented group node, whose `position` is
|
|
2409
2798
|
// already absolute. Nested groups are parent-relative, so they are skipped
|
|
@@ -2451,7 +2840,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2451
2840
|
maxY = Math.max(maxY, r.y + r.height);
|
|
2452
2841
|
}
|
|
2453
2842
|
if (!Number.isFinite(minX) || !Number.isFinite(minY)) return;
|
|
2454
|
-
|
|
2843
|
+
fitBoundsWithBias(
|
|
2455
2844
|
{
|
|
2456
2845
|
x: minX,
|
|
2457
2846
|
y: minY,
|
|
@@ -2461,7 +2850,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2461
2850
|
{ padding, duration: trailFocusDurationMs },
|
|
2462
2851
|
);
|
|
2463
2852
|
},
|
|
2464
|
-
[rectForNode,
|
|
2853
|
+
[rectForNode, fitBoundsWithBias, trailFocusDurationMs],
|
|
2465
2854
|
);
|
|
2466
2855
|
|
|
2467
2856
|
// The Containers list: every card frame in the laid-out graph, parents before
|
|
@@ -2538,11 +2927,12 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2538
2927
|
// frame the flow on the canvas. Selection state is cleared — the graph now
|
|
2539
2928
|
// reads as the narrative. No drawer: the code view only opens on a step
|
|
2540
2929
|
// click. A stale trail drawer (from a previously focused flow's step)
|
|
2541
|
-
// closes; an explicitly opened file drawer stays
|
|
2930
|
+
// closes; an explicitly opened file drawer stays unless a host asks for
|
|
2931
|
+
// file-free focus (e.g. a walkthrough step that only selects the trail).
|
|
2542
2932
|
// In `dim` mode: clear step highlight and leave the full graph visible
|
|
2543
2933
|
// (no zoom / hide) — matching "step away from a hovered step".
|
|
2544
2934
|
const focusTrailEdges = useCallback(
|
|
2545
|
-
(tl: SubsystemTrail) => {
|
|
2935
|
+
(tl: SubsystemTrail, closeFile = false) => {
|
|
2546
2936
|
setSelected(null);
|
|
2547
2937
|
setSelectedEdgeId(null);
|
|
2548
2938
|
setHoveredTrailStep(null);
|
|
@@ -2559,10 +2949,38 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2559
2949
|
setFocusedStepIndex(null);
|
|
2560
2950
|
setFocusedTrailId(tl.id);
|
|
2561
2951
|
onTrailSelect?.({ trailId: tl.id });
|
|
2562
|
-
|
|
2563
|
-
|
|
2952
|
+
const edgeIds = new Set([
|
|
2953
|
+
...tl.steps.map((s) => trailStepGraphEdgeId(s)),
|
|
2954
|
+
...(linkedEdgeIdsByTrail.get(tl.id) ?? []),
|
|
2955
|
+
]);
|
|
2956
|
+
const drawerWillClose =
|
|
2957
|
+
drawerOpenRef.current && (closeFile || drawerTarget?.kind === 'trail');
|
|
2958
|
+
setDrawerTarget((prev) =>
|
|
2959
|
+
closeFile || prev?.kind === 'trail' ? null : prev,
|
|
2960
|
+
);
|
|
2961
|
+
if (pendingFocusFitRef.current != null) {
|
|
2962
|
+
window.clearTimeout(pendingFocusFitRef.current);
|
|
2963
|
+
pendingFocusFitRef.current = null;
|
|
2964
|
+
}
|
|
2965
|
+
if (drawerWillClose) {
|
|
2966
|
+
// Wait for the canvas to reclaim the drawer's height, or the fit uses
|
|
2967
|
+
// the temporarily shortened viewport and settles too far off-centre.
|
|
2968
|
+
pendingFocusFitRef.current = window.setTimeout(() => {
|
|
2969
|
+
pendingFocusFitRef.current = null;
|
|
2970
|
+
requestAnimationFrame(() => fitFocusBounds(edgeIds));
|
|
2971
|
+
}, FILE_DRAWER_HEIGHT_MS + 20);
|
|
2972
|
+
} else {
|
|
2973
|
+
fitFocusBounds(edgeIds);
|
|
2974
|
+
}
|
|
2564
2975
|
},
|
|
2565
|
-
[
|
|
2976
|
+
[
|
|
2977
|
+
fitFocusBounds,
|
|
2978
|
+
trailStepMode,
|
|
2979
|
+
onTrailSelect,
|
|
2980
|
+
onSidebarTrailChange,
|
|
2981
|
+
drawerTarget,
|
|
2982
|
+
linkedEdgeIdsByTrail,
|
|
2983
|
+
],
|
|
2566
2984
|
);
|
|
2567
2985
|
|
|
2568
2986
|
const clearTrailFocus = useCallback(() => {
|
|
@@ -2610,11 +3028,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2610
3028
|
|
|
2611
3029
|
// Focus a single step's edge on the canvas and open/scroll the trail
|
|
2612
3030
|
// drawer to that step's snippet. Clicking the already-focused step clears
|
|
2613
|
-
// 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.
|
|
2614
3034
|
// In `dim` mode: only dim non-participants (same as hovering a step) —
|
|
2615
3035
|
// no camera move, no drawer, no hide.
|
|
2616
3036
|
const focusTrailStep = useCallback(
|
|
2617
|
-
(
|
|
3037
|
+
(
|
|
3038
|
+
tl: SubsystemTrail,
|
|
3039
|
+
stepIndex: number,
|
|
3040
|
+
showFile = true,
|
|
3041
|
+
options?: { allowToggle?: boolean },
|
|
3042
|
+
) => {
|
|
2618
3043
|
const step = tl.steps[stepIndex];
|
|
2619
3044
|
if (!step) return;
|
|
2620
3045
|
setSelected(null);
|
|
@@ -2627,29 +3052,48 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2627
3052
|
onTrailSelect?.(null);
|
|
2628
3053
|
return;
|
|
2629
3054
|
}
|
|
3055
|
+
// Opening the focused step's containing frames is what makes an
|
|
3056
|
+
// intra-process edge (e.g. api → store) renderable at all. Without this,
|
|
3057
|
+
// host-driven step focus can only frame cross-boundary hops.
|
|
3058
|
+
setExpandedTrails(new Set([tl.id]));
|
|
3059
|
+
setLayoutTrailId(tl.id);
|
|
2630
3060
|
// Toggle: clicking the selected step unselects it (back to whole flow).
|
|
2631
3061
|
onSidebarTrailChange(tl.id);
|
|
2632
|
-
if (
|
|
3062
|
+
if (
|
|
3063
|
+
(options?.allowToggle ?? true) &&
|
|
3064
|
+
focusedTrailId === tl.id &&
|
|
3065
|
+
focusedStepIndex === stepIndex
|
|
3066
|
+
) {
|
|
2633
3067
|
setFocusedStepIndex(null);
|
|
2634
3068
|
// Pointer is still over the row — keep hover preview so dimming doesn't
|
|
2635
3069
|
// flash off until mouseleave.
|
|
2636
3070
|
setHoveredTrailStep({ trailId: tl.id, stepIndex });
|
|
2637
|
-
setDrawerTarget((prev) =>
|
|
3071
|
+
setDrawerTarget((prev) =>
|
|
3072
|
+
!showFile ? null : prev?.kind === 'trail' ? null : prev,
|
|
3073
|
+
);
|
|
2638
3074
|
if (pendingFocusFitRef.current != null) {
|
|
2639
3075
|
window.clearTimeout(pendingFocusFitRef.current);
|
|
2640
3076
|
pendingFocusFitRef.current = null;
|
|
2641
3077
|
}
|
|
2642
|
-
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
|
+
);
|
|
2643
3085
|
return;
|
|
2644
3086
|
}
|
|
2645
3087
|
setFocusedStepIndex(stepIndex);
|
|
2646
3088
|
setFocusedTrailId(tl.id);
|
|
2647
3089
|
setHoveredTrailStep(null);
|
|
2648
3090
|
onTrailSelect?.({ trailId: tl.id, stepIndices: [stepIndex] });
|
|
2649
|
-
//
|
|
2650
|
-
// transition
|
|
3091
|
+
// The drawer changes the usable canvas height, so wait for its height
|
|
3092
|
+
// transition whenever we open or close it — not just when opening.
|
|
2651
3093
|
const drawerWasOpen = drawerOpenRef.current;
|
|
2652
|
-
if (
|
|
3094
|
+
if (!showFile) {
|
|
3095
|
+
setDrawerTarget(null);
|
|
3096
|
+
} else if (renderTrailViewer) {
|
|
2653
3097
|
setDrawerTarget({
|
|
2654
3098
|
kind: 'trail',
|
|
2655
3099
|
trailId: tl.id,
|
|
@@ -2663,12 +3107,16 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2663
3107
|
endLine: step.span?.endLine,
|
|
2664
3108
|
});
|
|
2665
3109
|
}
|
|
2666
|
-
const edgeIds = new Set([
|
|
3110
|
+
const edgeIds = new Set([
|
|
3111
|
+
trailStepGraphEdgeId(step),
|
|
3112
|
+
...(linkedEdgeIdsByTrail.get(tl.id) ?? []),
|
|
3113
|
+
...(variationEdgeIdsByTrail.get(tl.id) ?? []),
|
|
3114
|
+
]);
|
|
2667
3115
|
if (pendingFocusFitRef.current != null) {
|
|
2668
3116
|
window.clearTimeout(pendingFocusFitRef.current);
|
|
2669
3117
|
pendingFocusFitRef.current = null;
|
|
2670
3118
|
}
|
|
2671
|
-
if (drawerWasOpen) {
|
|
3119
|
+
if (drawerWasOpen === showFile) {
|
|
2672
3120
|
fitFocusBounds(edgeIds);
|
|
2673
3121
|
} else {
|
|
2674
3122
|
pendingFocusFitRef.current = window.setTimeout(() => {
|
|
@@ -2685,9 +3133,65 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2685
3133
|
trailStepMode,
|
|
2686
3134
|
onTrailSelect,
|
|
2687
3135
|
onSidebarTrailChange,
|
|
3136
|
+
linkedEdgeIdsByTrail,
|
|
3137
|
+
variationEdgeIdsByTrail,
|
|
2688
3138
|
],
|
|
2689
3139
|
);
|
|
2690
3140
|
|
|
3141
|
+
// Host-controlled trail focus for agent-driven walkthroughs. Unlike
|
|
3142
|
+
// `initialTrailId`, this is repeatable. A `stepIndex` focuses one step;
|
|
3143
|
+
// omitting it frames the whole trail. `showFile: false` selects without
|
|
3144
|
+
// opening the file/trail drawer. `undefined` leaves graph-owned focus alone;
|
|
3145
|
+
// `null` hands control back to the graph.
|
|
3146
|
+
const appliedFocusedTrailStepRef = useRef<string | null>(null);
|
|
3147
|
+
useEffect(() => {
|
|
3148
|
+
if (focusedTrailStep === undefined) return;
|
|
3149
|
+
if (focusedTrailStep === null) {
|
|
3150
|
+
if (appliedFocusedTrailStepRef.current == null) return;
|
|
3151
|
+
appliedFocusedTrailStepRef.current = null;
|
|
3152
|
+
clearTrailFocus();
|
|
3153
|
+
return;
|
|
3154
|
+
}
|
|
3155
|
+
const { trailId, stepIndex } = focusedTrailStep;
|
|
3156
|
+
const showFile = focusedTrailStep.showFile ?? stepIndex != null;
|
|
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}`;
|
|
3169
|
+
if (appliedFocusedTrailStepRef.current === key) return;
|
|
3170
|
+
if (!layoutReady || !trails?.length) return;
|
|
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);
|
|
3175
|
+
if (!tl) return;
|
|
3176
|
+
if (stepIndex != null && !tl.steps[stepIndex]) return;
|
|
3177
|
+
appliedFocusedTrailStepRef.current = key;
|
|
3178
|
+
if (stepIndex == null) {
|
|
3179
|
+
focusTrailEdges(tl, !showFile);
|
|
3180
|
+
} else {
|
|
3181
|
+
focusTrailStep(tl, stepIndex, showFile, { allowToggle: false });
|
|
3182
|
+
}
|
|
3183
|
+
}, [
|
|
3184
|
+
focusedTrailStep,
|
|
3185
|
+
layoutReady,
|
|
3186
|
+
trails,
|
|
3187
|
+
focusTrailEdges,
|
|
3188
|
+
focusTrailStep,
|
|
3189
|
+
clearTrailFocus,
|
|
3190
|
+
linkedEdgeIdsByTrail,
|
|
3191
|
+
focusedVariationStepIndexes,
|
|
3192
|
+
layoutTrails,
|
|
3193
|
+
]);
|
|
3194
|
+
|
|
2691
3195
|
useEffect(() => {
|
|
2692
3196
|
return () => {
|
|
2693
3197
|
if (pendingFocusFitRef.current != null) {
|
|
@@ -3084,14 +3588,18 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3084
3588
|
const labels = dispEdges
|
|
3085
3589
|
.filter((e) => {
|
|
3086
3590
|
if (e.hidden) return false;
|
|
3087
|
-
const d = e?.data as
|
|
3088
|
-
|
|
3591
|
+
const d = e?.data as
|
|
3592
|
+
| { dimmed?: boolean; ghost?: boolean; proposed?: boolean }
|
|
3593
|
+
| undefined;
|
|
3594
|
+
return !d?.dimmed || d?.ghost || d?.proposed;
|
|
3089
3595
|
})
|
|
3090
3596
|
.map((e) => {
|
|
3091
3597
|
const d = e.data as {
|
|
3092
3598
|
mechanism?: string;
|
|
3093
3599
|
provenance?: SubsystemEdgeProvenance;
|
|
3094
3600
|
dimmed?: boolean;
|
|
3601
|
+
ghost?: boolean;
|
|
3602
|
+
proposed?: boolean;
|
|
3095
3603
|
labelX?: number;
|
|
3096
3604
|
labelY?: number;
|
|
3097
3605
|
pathLength?: number;
|
|
@@ -3102,6 +3610,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3102
3610
|
mechanism: d?.mechanism ?? 'uses',
|
|
3103
3611
|
provenance: d?.provenance,
|
|
3104
3612
|
dimmed: d?.dimmed === true,
|
|
3613
|
+
ghost: d?.ghost === true,
|
|
3614
|
+
proposed: d?.proposed === true,
|
|
3105
3615
|
midX: d?.labelX ?? 0,
|
|
3106
3616
|
midY: d?.labelY ?? 0,
|
|
3107
3617
|
pathLength: d?.pathLength ?? 0,
|
|
@@ -3210,6 +3720,24 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3210
3720
|
}}
|
|
3211
3721
|
/>
|
|
3212
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]);
|
|
3213
3741
|
const trailNavigation = trails && trails.length > 0 ? (
|
|
3214
3742
|
<TrailsPanel
|
|
3215
3743
|
drilldown={trailStepMode !== 'dim'}
|
|
@@ -3217,6 +3745,11 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3217
3745
|
expandedTrails={expandedTrails}
|
|
3218
3746
|
focusedTrailId={sidebarTrail?.id ?? focusedTrailId}
|
|
3219
3747
|
focusedStepIndex={!sidebarTrail || focusedTrailId === sidebarTrail.id ? focusedStepIndex : null}
|
|
3748
|
+
proposedTrailIds={proposedTrailIds}
|
|
3749
|
+
proposedStepKeys={proposedStepKeys}
|
|
3750
|
+
focusedVariationStepIndexes={panelFocusedVariationStepIndexes}
|
|
3751
|
+
stepNumberLabels={panelStepNumberLabels}
|
|
3752
|
+
stepChange={stepChange}
|
|
3220
3753
|
detailContent={sidebarPanel}
|
|
3221
3754
|
hoveredTrailStep={hoveredTrailStep}
|
|
3222
3755
|
onToggleCollapsed={toggleTrailCollapsed}
|
|
@@ -3355,7 +3888,9 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3355
3888
|
{edgeLabels.map((lbl) => {
|
|
3356
3889
|
const mechanism = lbl.mechanism;
|
|
3357
3890
|
const isGraphify = lbl.provenance === 'graphify';
|
|
3358
|
-
const color =
|
|
3891
|
+
const color = lbl.proposed
|
|
3892
|
+
? HOST_PROPOSAL_COLOR
|
|
3893
|
+
: edgeColor({ mechanism, provenance: lbl.provenance });
|
|
3359
3894
|
// Label chrome stays the crisp rounded box for every edge — graphify
|
|
3360
3895
|
// provenance is carried by hue (GRAPHIFY_RELATION_COLOR), the dashed
|
|
3361
3896
|
// stroke, and the tooltip, NOT by the "ambiguous" cloud silhouette
|
|
@@ -3368,9 +3903,13 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3368
3903
|
: undefined;
|
|
3369
3904
|
const screenX = lbl.midX * viewport.zoom + viewport.x;
|
|
3370
3905
|
const screenY = lbl.midY * viewport.zoom + viewport.y;
|
|
3371
|
-
const text = lbl.
|
|
3372
|
-
?
|
|
3373
|
-
: 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;
|
|
3374
3913
|
return (
|
|
3375
3914
|
<div
|
|
3376
3915
|
key={lbl.id}
|
|
@@ -3398,7 +3937,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3398
3937
|
padding: '7px 8px',
|
|
3399
3938
|
cursor: 'pointer',
|
|
3400
3939
|
pointerEvents: 'auto',
|
|
3401
|
-
opacity: lbl.dimmed ? 0.15 : 1,
|
|
3940
|
+
opacity: lbl.ghost ? 0.5 : lbl.proposed ? 1 : lbl.dimmed ? 0.15 : 1,
|
|
3402
3941
|
}}
|
|
3403
3942
|
>
|
|
3404
3943
|
{/* Background layer. Opaque theme surface (matches the node fill)
|
|
@@ -3996,7 +4535,7 @@ export function SubsystemComponentGraph(props: SubsystemComponentGraphProps) {
|
|
|
3996
4535
|
flexDirection: 'column',
|
|
3997
4536
|
}}
|
|
3998
4537
|
>
|
|
3999
|
-
{!constructsOnly && !props.hideSidebar && (
|
|
4538
|
+
{!constructsOnly && !props.hideSidebar && !props.hideHeader && (
|
|
4000
4539
|
<header
|
|
4001
4540
|
style={{
|
|
4002
4541
|
flexShrink: 0,
|