@principal-ai/subsystems-react 0.56.26 → 0.56.28
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.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +140 -27
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/model.d.ts +7 -0
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js +27 -0
- package/dist/subsystem/model.js.map +1 -1
- package/package.json +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +174 -45
- package/src/subsystem/model.collapse.test.ts +35 -1
- package/src/subsystem/model.ts +28 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubsystemComponentGraph.d.ts","sourceRoot":"","sources":["../../src/subsystem/SubsystemComponentGraph.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SubsystemComponentGraph.d.ts","sourceRoot":"","sources":["../../src/subsystem/SubsystemComponentGraph.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAiC,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBtE,OAAO,EAiBL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAI9B,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAIjB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;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;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC1D;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,oBAAoB,CAAC;KAC3B,KAAK,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAAC;IACjE;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC;IACjE;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAwpGD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,+BAoN1E"}
|
|
@@ -20,7 +20,7 @@ import { ReactFlow, ReactFlowProvider, useReactFlow, useViewport, applyNodeChang
|
|
|
20
20
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
21
21
|
import { SUBSYSTEM_MODEL_DESCRIPTION_MAX } from '@principal-ai/subsystems-core';
|
|
22
22
|
import { ArrowDown, ArrowRight, Boxes, Files, Route, Unlink, X } from 'lucide-react';
|
|
23
|
-
import { buildSubsystemGraph, deriveGraphEdges, buildBoundaryLayoutGroups, isCardFrame, isConstructsOnlyModel, packageColor, moduleGroupNodeId, processGroupNodeId, isTrailMechanism, edgeColor, MECHANISM_DESCRIPTIONS, subsystemGraphLayoutKey, trailStepGraphEdgeId, unroutedEdgeIds, } from './model';
|
|
23
|
+
import { buildSubsystemGraph, componentPackageKey, deriveGraphEdges, buildBoundaryLayoutGroups, cardFramesForAliases, isCardFrame, isConstructsOnlyModel, packageColor, moduleGroupNodeId, processGroupNodeId, isTrailMechanism, edgeColor, MECHANISM_DESCRIPTIONS, subsystemGraphLayoutKey, trailStepGraphEdgeId, unroutedEdgeIds, } from './model';
|
|
24
24
|
import { ConstructsCatalog } from './ConstructsCatalog';
|
|
25
25
|
import { ContainersPanel } from './ContainersPanel';
|
|
26
26
|
import { technologyBrand } from './techIcons';
|
|
@@ -92,6 +92,42 @@ function edgeMatches(set, e) {
|
|
|
92
92
|
const ids = e.data?.rolledUpIds;
|
|
93
93
|
return ids?.some((id) => set.has(id)) === true;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether a boundary region holds any of `aliases` — i.e. whether hovering a
|
|
97
|
+
* trail should keep its container bright. Reads component membership directly
|
|
98
|
+
* (process / module / package / directory path) so nesting is transitive: a
|
|
99
|
+
* package lights when a leaf in its nested process is in the trail, even
|
|
100
|
+
* though the package's layout member list only holds the nested group id.
|
|
101
|
+
* This also covers trails folded into nothing (a step whose endpoints share
|
|
102
|
+
* one collapsed card leaves no edge for `endpointsOf` to find).
|
|
103
|
+
*/
|
|
104
|
+
function regionTouchesTrailAliases(region, aliases, byAlias) {
|
|
105
|
+
if (!region || !aliases || aliases.size === 0)
|
|
106
|
+
return false;
|
|
107
|
+
for (const alias of aliases) {
|
|
108
|
+
const comp = byAlias.get(alias);
|
|
109
|
+
if (!comp)
|
|
110
|
+
continue;
|
|
111
|
+
if (region.kind === 'process') {
|
|
112
|
+
if (comp.process === region.key)
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
else if (region.kind === 'module') {
|
|
116
|
+
if (comp.module?.trim() === region.key)
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
else if (region.kind === 'directory') {
|
|
120
|
+
const m = comp.module?.trim().replace(/\\/g, '/');
|
|
121
|
+
if (m === region.key || (m != null && m.startsWith(`${region.key}/`)))
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
else if (region.kind === 'package') {
|
|
125
|
+
if (componentPackageKey(comp) === region.key)
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
95
131
|
const nodeTypes = {
|
|
96
132
|
'subsystem-component': SubsystemComponentNode,
|
|
97
133
|
'subsystem-group': SubsystemGroupNode,
|
|
@@ -227,7 +263,39 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
227
263
|
// every card frame takes, `toggledGroupIds` the frames flipped away from it.
|
|
228
264
|
const [framesCollapsed, setFramesCollapsed] = useState(() => persisted.framesCollapsed ?? defaultFramesCollapsed);
|
|
229
265
|
const [toggledGroupIds, setToggledGroupIds] = useState(() => new Set(persisted.toggledFrames ?? []));
|
|
230
|
-
|
|
266
|
+
// Picking a trail opens the container cards that hold its cast, so the flow
|
|
267
|
+
// reads as its components instead of a row of folded boxes. Derived rather
|
|
268
|
+
// than written into the user's frame state: clearing the trail — or moving to
|
|
269
|
+
// another — restores exactly the frames they had open before.
|
|
270
|
+
const trailFrameIds = useMemo(() => {
|
|
271
|
+
if (!layoutTrailId)
|
|
272
|
+
return new Set();
|
|
273
|
+
const trail = (trails ?? []).find((t) => t.id === layoutTrailId);
|
|
274
|
+
if (!trail)
|
|
275
|
+
return new Set();
|
|
276
|
+
const aliases = new Set();
|
|
277
|
+
for (const step of trail.steps) {
|
|
278
|
+
aliases.add(step.from);
|
|
279
|
+
aliases.add(step.to);
|
|
280
|
+
}
|
|
281
|
+
return cardFramesForAliases({ components }, aliases, { showSingletonFrames, moduleNesting, codeProcessKeys });
|
|
282
|
+
}, [layoutTrailId, trails, components, showSingletonFrames, moduleNesting, codeProcessKeys]);
|
|
283
|
+
// `framesCollapsed` is the default every card takes; a toggled id is the
|
|
284
|
+
// exception. Opening a trail's frames therefore means adding them to the
|
|
285
|
+
// default-collapsed set (or removing them from the default-open one).
|
|
286
|
+
const effectiveToggledGroupIds = useMemo(() => {
|
|
287
|
+
if (trailFrameIds.size === 0)
|
|
288
|
+
return toggledGroupIds;
|
|
289
|
+
const next = new Set(toggledGroupIds);
|
|
290
|
+
for (const id of trailFrameIds) {
|
|
291
|
+
if (framesCollapsed)
|
|
292
|
+
next.add(id);
|
|
293
|
+
else
|
|
294
|
+
next.delete(id);
|
|
295
|
+
}
|
|
296
|
+
return next;
|
|
297
|
+
}, [toggledGroupIds, trailFrameIds, framesCollapsed]);
|
|
298
|
+
const [committedCollapsed, setCommittedCollapsed] = useState({ framesCollapsed, toggled: effectiveToggledGroupIds });
|
|
231
299
|
const toggleCollapsed = useCallback((groupId) => {
|
|
232
300
|
setToggledGroupIds((prev) => {
|
|
233
301
|
const next = new Set(prev);
|
|
@@ -242,7 +310,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
242
310
|
setFramesCollapsed(collapsed);
|
|
243
311
|
setToggledGroupIds(new Set());
|
|
244
312
|
}, []);
|
|
245
|
-
const collapsedKey = `${framesCollapsed ? 'closed' : 'open'}:${Array.from(
|
|
313
|
+
const collapsedKey = `${framesCollapsed ? 'closed' : 'open'}:${Array.from(effectiveToggledGroupIds).sort().join(',')}`;
|
|
246
314
|
const committedCollapsedKey = `${committedCollapsed.framesCollapsed ? 'closed' : 'open'}:${Array.from(committedCollapsed.toggled).sort().join(',')}`;
|
|
247
315
|
const changeLayoutDirection = useCallback((next) => {
|
|
248
316
|
if (next === requestedDirection)
|
|
@@ -284,7 +352,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
284
352
|
if (reduceMotion) {
|
|
285
353
|
setCommittedDirection(requestedDirection);
|
|
286
354
|
setCommittedTrailId(layoutTrailId);
|
|
287
|
-
setCommittedCollapsed({ framesCollapsed, toggled:
|
|
355
|
+
setCommittedCollapsed({ framesCollapsed, toggled: effectiveToggledGroupIds });
|
|
288
356
|
return;
|
|
289
357
|
}
|
|
290
358
|
flipSawPendingLayoutRef.current = false;
|
|
@@ -293,7 +361,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
293
361
|
flipFadeTimerRef.current = null;
|
|
294
362
|
setCommittedDirection(requestedDirection);
|
|
295
363
|
setCommittedTrailId(layoutTrailId);
|
|
296
|
-
setCommittedCollapsed({ framesCollapsed, toggled:
|
|
364
|
+
setCommittedCollapsed({ framesCollapsed, toggled: effectiveToggledGroupIds });
|
|
297
365
|
}, LAYOUT_FLIP_EDGE_MS);
|
|
298
366
|
return () => {
|
|
299
367
|
if (flipFadeTimerRef.current != null) {
|
|
@@ -308,7 +376,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
308
376
|
requestedDirection,
|
|
309
377
|
layoutTrailId,
|
|
310
378
|
framesCollapsed,
|
|
311
|
-
|
|
379
|
+
effectiveToggledGroupIds,
|
|
312
380
|
]);
|
|
313
381
|
// Beat 3: the committed layout has settled → the node slide is over, fade
|
|
314
382
|
// the edges back in. The ref keeps the OLD `layoutReady` (still true until
|
|
@@ -1162,6 +1230,34 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1162
1230
|
const openedNodeIds = useMemo(() => endpointsOf(openedEdgeIds),
|
|
1163
1231
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1164
1232
|
[baseEdges, openedEdgeIds]);
|
|
1233
|
+
// Component aliases touched by the hovered trail — the whole flow when a
|
|
1234
|
+
// collapsed row is hovered, one step's endpoints otherwise. Drives container
|
|
1235
|
+
// dimming directly (rather than via rolled-up edge endpoints) so a parent
|
|
1236
|
+
// frame lights when any transitive member is in the trail, and a trail
|
|
1237
|
+
// folded entirely inside one collapsed card still dims the other cards.
|
|
1238
|
+
const hoverTrailAliases = useMemo(() => {
|
|
1239
|
+
if (!hoveredTrailStep || !trails)
|
|
1240
|
+
return null;
|
|
1241
|
+
const tl = trails.find((t) => t.id === hoveredTrailStep.trailId);
|
|
1242
|
+
if (!tl)
|
|
1243
|
+
return null;
|
|
1244
|
+
const ids = new Set();
|
|
1245
|
+
if (hoveredTrailStep.stepIndex == null) {
|
|
1246
|
+
for (const s of tl.steps) {
|
|
1247
|
+
ids.add(s.from);
|
|
1248
|
+
ids.add(s.to);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
const step = tl.steps[hoveredTrailStep.stepIndex];
|
|
1253
|
+
if (!step)
|
|
1254
|
+
return null;
|
|
1255
|
+
ids.add(step.from);
|
|
1256
|
+
ids.add(step.to);
|
|
1257
|
+
}
|
|
1258
|
+
return ids.size > 0 ? ids : null;
|
|
1259
|
+
}, [trails, hoveredTrailStep]);
|
|
1260
|
+
const aliasToComponent = useMemo(() => new Map(components.map((c) => [c.alias, c])), [components]);
|
|
1165
1261
|
// Endpoints of the bright set: the selected step's edge, or the whole flow
|
|
1166
1262
|
// when no step is focused.
|
|
1167
1263
|
const brightNodeIds = useMemo(() => endpointsOf(focusEdgeIds),
|
|
@@ -1205,13 +1301,19 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1205
1301
|
// there is no opened set, so dimming has to be driven from the
|
|
1206
1302
|
// participants or nothing outside the focused step would dim.
|
|
1207
1303
|
const dimSource = previewNodeIds ?? brightNodeIds ?? issueFocusNodeIds;
|
|
1304
|
+
// Hover keeps a container bright when any of its contents is in the
|
|
1305
|
+
// hovered trail — read off component membership so nesting is
|
|
1306
|
+
// transitive and internally-folded trails still count.
|
|
1307
|
+
const touchesHover = regionTouchesTrailAliases(region, hoverTrailAliases, aliasToComponent);
|
|
1308
|
+
const inSpotlight = memberAliases.some((alias) => dimSource?.has(alias) === true) || touchesHover;
|
|
1309
|
+
const anySpotlight = dimSource != null || hoverTrailAliases != null;
|
|
1208
1310
|
const { hidden, dimmed } = flowNodeVisibility({
|
|
1209
1311
|
inOpened: memberAliases.some((alias) => openedNodeIds?.has(alias) === true),
|
|
1210
1312
|
inSelected: memberAliases.some((alias) => brightNodeIds?.has(alias) === true),
|
|
1211
|
-
inSpotlight
|
|
1313
|
+
inSpotlight,
|
|
1212
1314
|
anyOpened: openedNodeIds != null,
|
|
1213
1315
|
anySelected: brightNodeIds != null,
|
|
1214
|
-
anySpotlight
|
|
1316
|
+
anySpotlight,
|
|
1215
1317
|
});
|
|
1216
1318
|
// Host override wins over the library's derived frame color.
|
|
1217
1319
|
const color = region?.key != null ? boundaryColors?.[region.key] : undefined;
|
|
@@ -1243,10 +1345,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1243
1345
|
const { hidden, dimmed } = flowNodeVisibility({
|
|
1244
1346
|
inOpened: openedNodeIds?.has(n.id) === true,
|
|
1245
1347
|
inSelected: brightNodeIds?.has(n.id) === true,
|
|
1246
|
-
inSpotlight: dimSource?.has(n.id) === true,
|
|
1348
|
+
inSpotlight: dimSource?.has(n.id) === true || (hoverTrailAliases?.has(n.id) === true),
|
|
1247
1349
|
anyOpened: openedNodeIds != null,
|
|
1248
1350
|
anySelected: brightNodeIds != null,
|
|
1249
|
-
anySpotlight: dimSource != null,
|
|
1351
|
+
anySpotlight: dimSource != null || hoverTrailAliases != null,
|
|
1250
1352
|
});
|
|
1251
1353
|
// Component findings key by alias, boundary findings by region node id.
|
|
1252
1354
|
// The two id spaces are disjoint (`module:` / `process:` are prefixed), so
|
|
@@ -1268,7 +1370,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
1268
1370
|
},
|
|
1269
1371
|
};
|
|
1270
1372
|
});
|
|
1271
|
-
}, [xyflowNodesBase, openFile, selected, focusNodeIds, openedNodeIds, brightNodeIds, previewNodeIds, issueFocusNodeIds, issueBadgeByAlias, regionIssueByNodeId, boundaryColors, toggleCollapsed]);
|
|
1373
|
+
}, [xyflowNodesBase, openFile, selected, focusNodeIds, openedNodeIds, brightNodeIds, previewNodeIds, hoverTrailAliases, aliasToComponent, issueFocusNodeIds, issueBadgeByAlias, regionIssueByNodeId, boundaryColors, toggleCollapsed]);
|
|
1272
1374
|
const baseNodesKey = useMemo(() => nodes.map((n) => n.id).sort().join(','), [nodes]);
|
|
1273
1375
|
const baseEdgesKey = useMemo(() => convertedEdges.map((e) => e.id).sort().join(','), [convertedEdges]);
|
|
1274
1376
|
const dispEdges = useMemo(() => {
|
|
@@ -2568,6 +2670,32 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2568
2670
|
focusedTrail &&
|
|
2569
2671
|
renderTrailViewer ? (_jsx(TrailDrawerContent, { render: renderTrailDrawerContent, trail: focusedTrail, stepIndex: drawerTarget.stepIndex, onOpenFile: onOpenFileFromTrail, resolveSymbol: resolveTrailSymbol, onSymbolClick: openConstructDeclaration, onVisibleStepChange: setVisibleStepIndex })) : drawerTarget?.kind === 'file' ? (_jsx(FileDrawerContent, { render: renderDrawerContent, file: drawerTarget.file, startLine: drawerTarget.startLine, endLine: drawerTarget.endLine })) : null }), committedDirection !== 'vertical' && fileOverlayView, !transparentCanvas && _jsx(GraphLayoutCover, { revealed: layoutReady || layoutFlipping }), canvasOverlay, liveEvents ? _jsx(MaintainLivePanel, { ...liveEvents }) : null] })] }));
|
|
2570
2672
|
}
|
|
2673
|
+
/**
|
|
2674
|
+
* One option in the header's segmented sidebar-view switch. Owns the hover
|
|
2675
|
+
* state so every segment reacts the same way — the Issues segment is a
|
|
2676
|
+
* `SubsystemDiagnosticToggle` and already hovers; keeping the plain options
|
|
2677
|
+
* here means the switch has one hover affordance, not two.
|
|
2678
|
+
*/
|
|
2679
|
+
function SidebarViewOption({ active, ariaLabel, title, onClick, children, }) {
|
|
2680
|
+
const { theme } = useTheme();
|
|
2681
|
+
const [hover, setHover] = useState(false);
|
|
2682
|
+
return (_jsx("button", { type: "button", "aria-label": ariaLabel, title: title, "aria-pressed": active, onClick: onClick, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), style: {
|
|
2683
|
+
display: 'inline-flex',
|
|
2684
|
+
alignItems: 'center',
|
|
2685
|
+
justifyContent: 'center',
|
|
2686
|
+
gap: 4,
|
|
2687
|
+
height: 28,
|
|
2688
|
+
padding: '4px 16px',
|
|
2689
|
+
fontFamily: theme.fonts.monospace,
|
|
2690
|
+
fontSize: theme.fontSizes[0],
|
|
2691
|
+
border: 'none',
|
|
2692
|
+
borderRadius: 4,
|
|
2693
|
+
background: active || hover ? theme.colors.border : 'transparent',
|
|
2694
|
+
color: active ? theme.colors.text : (theme.colors.textMuted ?? theme.colors.textSecondary),
|
|
2695
|
+
cursor: 'pointer',
|
|
2696
|
+
transition: 'background 120ms ease',
|
|
2697
|
+
}, children: children }));
|
|
2698
|
+
}
|
|
2571
2699
|
export function SubsystemComponentGraph(props) {
|
|
2572
2700
|
const { theme } = useTheme();
|
|
2573
2701
|
const wrapRef = useRef(null);
|
|
@@ -2617,21 +2745,6 @@ export function SubsystemComponentGraph(props) {
|
|
|
2617
2745
|
props.diagnostic?.onToggle?.();
|
|
2618
2746
|
}
|
|
2619
2747
|
};
|
|
2620
|
-
const viewButtonStyle = (active) => ({
|
|
2621
|
-
display: 'inline-flex',
|
|
2622
|
-
alignItems: 'center',
|
|
2623
|
-
justifyContent: 'center',
|
|
2624
|
-
gap: 4,
|
|
2625
|
-
height: 28,
|
|
2626
|
-
padding: '4px 16px',
|
|
2627
|
-
fontFamily: theme.fonts.monospace,
|
|
2628
|
-
fontSize: theme.fontSizes[0],
|
|
2629
|
-
border: 'none',
|
|
2630
|
-
borderRadius: 4,
|
|
2631
|
-
background: active ? theme.colors.border : 'transparent',
|
|
2632
|
-
color: active ? theme.colors.text : (theme.colors.textMuted ?? theme.colors.textSecondary),
|
|
2633
|
-
cursor: 'pointer',
|
|
2634
|
-
});
|
|
2635
2748
|
useEffect(() => {
|
|
2636
2749
|
if (props.initialTrailId)
|
|
2637
2750
|
setFilesOpen(false);
|
|
@@ -2691,6 +2804,6 @@ export function SubsystemComponentGraph(props) {
|
|
|
2691
2804
|
padding: 2,
|
|
2692
2805
|
border: `1px solid ${theme.colors.border}`,
|
|
2693
2806
|
borderRadius: 6,
|
|
2694
|
-
}, children: [containerCount > 0 && (_jsxs(
|
|
2807
|
+
}, children: [containerCount > 0 && (_jsxs(SidebarViewOption, { ariaLabel: `Containers (${containerCount} ${containerCount === 1 ? 'container' : 'containers'})`, title: "Show containers", active: containersActive, onClick: () => selectSidebarView('containers'), children: [_jsx(Boxes, { size: 14, "aria-hidden": true }), _jsx("span", { children: "Containers" }), _jsx("span", { style: { fontWeight: 600, marginLeft: 4 }, children: containerCount })] })), _jsxs(SidebarViewOption, { ariaLabel: sidebarScope.trail ? 'Trail' : `Trails (${trailCount} ${trailCount === 1 ? 'trail' : 'trails'})`, active: !filesActive && !containersActive && !issuesActive, onClick: () => selectSidebarView('trails'), children: [_jsx(Route, { size: 14, "aria-hidden": true }), _jsx("span", { children: trailViewLabel }), !sidebarScope.trail && _jsx("span", { style: { fontWeight: 600, marginLeft: 4 }, children: trailCount })] }), hasFiles && (_jsxs(SidebarViewOption, { ariaLabel: `Files (${fileCount} files)`, title: "Show files", active: filesActive, onClick: () => selectSidebarView('files'), children: [_jsx(Files, { size: 14, "aria-hidden": true }), _jsx("span", { children: "Files" }), _jsx("span", { style: { fontWeight: 600, marginLeft: 4 }, children: fileCount })] })), hasIssues && (_jsx(SubsystemDiagnosticToggle, { ...sidebarDiagnostic, labelText: "Issues", segmented: true, active: issuesActive, onToggle: () => selectSidebarView('issues') }))] }), props.headerActions] })), _jsx("div", { ref: wrapRef, style: { flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column' }, children: constructsOnly ? (_jsx(ConstructsCatalog, { components: props.components, onSelect: props.onSelect, title: props.title, hideSidebar: props.hideSidebar, description: props.description, notes: props.notes, descriptionOpen: props.descriptionOpen, onDescriptionOpenChange: props.onDescriptionOpenChange, diagnostic: props.diagnostic, sidebarExtra: props.headerActions ? _jsxs(_Fragment, { children: [props.headerActions, props.sidebarExtra] }) : props.sidebarExtra, sidebarAfterDescription: props.sidebarAfterDescription, renderFileViewer: props.renderFileViewer, onFileSelect: props.onFileSelect, componentVerification: props.componentVerification, onInspectSymbol: props.onInspectSymbol })) : (_jsx(ReactFlowProvider, { children: _jsx(Inner, { ...props, showIssues: issuesActive, filesActive: filesActive, containersActive: containersActive, measured: size, sidebarScope: sidebarScope, onSidebarTrailChange: setSidebarTrailId }) })) })] }));
|
|
2695
2808
|
}
|
|
2696
2809
|
//# sourceMappingURL=SubsystemComponentGraph.js.map
|