@principal-ai/subsystems-react 0.56.1 → 0.56.3
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/FileDrawer.d.ts +11 -11
- package/dist/subsystem/FileDrawer.d.ts.map +1 -1
- package/dist/subsystem/FileDrawer.js +92 -26
- package/dist/subsystem/FileDrawer.js.map +1 -1
- package/dist/subsystem/GraphSidebar.d.ts.map +1 -1
- package/dist/subsystem/GraphSidebar.js +3 -1
- package/dist/subsystem/GraphSidebar.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +4 -3
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +32 -30
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/package.json +1 -1
- package/src/stories/Canvases/Subsystem/LayoutDirection.stories.tsx +55 -3
- package/src/subsystem/FileDrawer.test.tsx +233 -0
- package/src/subsystem/FileDrawer.tsx +108 -30
- package/src/subsystem/GraphSidebar.test.tsx +56 -1
- package/src/subsystem/GraphSidebar.tsx +3 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +66 -57
|
@@ -199,7 +199,7 @@ export interface SubsystemComponentGraphProps {
|
|
|
199
199
|
* sidebar's bottom half offers a Files/Trails toggle:
|
|
200
200
|
* the flows panel lists each trail's steps (`symbol` or `file:line`);
|
|
201
201
|
* clicking a flow row toggles its steps; clicking a step focuses that
|
|
202
|
-
* step's edge and (when `renderTrailViewer` is set) opens the
|
|
202
|
+
* step's edge and (when `renderTrailViewer` is set) opens the code
|
|
203
203
|
* drawer on that flow's snippets. Opened flows stay on the canvas
|
|
204
204
|
* (unselected ones dimmed); everything else is hidden.
|
|
205
205
|
*/
|
|
@@ -450,8 +450,9 @@ export interface SubsystemComponentGraphProps {
|
|
|
450
450
|
renderFileViewer?: (file: string, opts?: SubsystemOpenFileOptions) => ReactNode;
|
|
451
451
|
/**
|
|
452
452
|
* Host-injected multi-snippet viewer for a focused trail. When set,
|
|
453
|
-
* clicking a flow step opens the
|
|
454
|
-
* updates it as the focused step changes.
|
|
453
|
+
* clicking a flow step opens the code drawer with this content and
|
|
454
|
+
* updates it as the focused step changes. Docks left for vertical layouts,
|
|
455
|
+
* below the canvas for horizontal layouts.
|
|
455
456
|
*/
|
|
456
457
|
renderTrailViewer?: (ctx: TrailViewerContext) => ReactNode;
|
|
457
458
|
/**
|
|
@@ -928,10 +929,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
928
929
|
const showDesc = !!description && descriptionVisible;
|
|
929
930
|
// Sidebar width lives in the shared GraphWithSidebar chrome — draggable and
|
|
930
931
|
// persisted under `principal.subsystems.sidebarWidth.<persistKey>`. The graph
|
|
931
|
-
//
|
|
932
|
+
// caps it at half the view width so the canvas keeps room to breathe;
|
|
932
933
|
// a width saved under the old view-state key still seeds the panel once.
|
|
933
934
|
const sidebarMaxWidth = useMemo(
|
|
934
|
-
() => Math.max(
|
|
935
|
+
() => Math.max((_measured?.w ?? 680) * 0.5, 240),
|
|
935
936
|
[_measured?.w],
|
|
936
937
|
);
|
|
937
938
|
// Persist the trail working set per model. Each write merges into the
|
|
@@ -2080,7 +2081,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2080
2081
|
const drawerFillHeight =
|
|
2081
2082
|
drawerTarget?.kind === 'file' && drawerTarget.startLine == null;
|
|
2082
2083
|
const fileOverlayOpen = fileOverlay != null;
|
|
2083
|
-
const collapseCanvas =
|
|
2084
|
+
const collapseCanvas =
|
|
2085
|
+
drawerFillHeight || (fileOverlayOpen && committedDirection !== 'vertical');
|
|
2084
2086
|
|
|
2085
2087
|
// Drop the full-file overlay when the underlying trail drawer changes
|
|
2086
2088
|
// or closes — open-file keeps the same drawerTarget so the snippets stay mounted.
|
|
@@ -3041,6 +3043,57 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3041
3043
|
})}
|
|
3042
3044
|
</>
|
|
3043
3045
|
) : null;
|
|
3046
|
+
const fileOverlayView = fileOverlay && (
|
|
3047
|
+
<div
|
|
3048
|
+
style={{
|
|
3049
|
+
position: 'absolute',
|
|
3050
|
+
inset: 0,
|
|
3051
|
+
zIndex: 8,
|
|
3052
|
+
display: 'flex',
|
|
3053
|
+
flexDirection: 'column',
|
|
3054
|
+
background: theme.colors.background,
|
|
3055
|
+
borderLeft: `1px solid ${theme.colors.border}`,
|
|
3056
|
+
}}
|
|
3057
|
+
>
|
|
3058
|
+
<div
|
|
3059
|
+
style={{
|
|
3060
|
+
display: 'flex',
|
|
3061
|
+
alignItems: 'center',
|
|
3062
|
+
gap: 8,
|
|
3063
|
+
padding: '6px 10px',
|
|
3064
|
+
borderBottom: `1px solid ${theme.colors.border}`,
|
|
3065
|
+
flexShrink: 0,
|
|
3066
|
+
}}
|
|
3067
|
+
>
|
|
3068
|
+
<span
|
|
3069
|
+
title={fileOverlay.file}
|
|
3070
|
+
style={{
|
|
3071
|
+
flex: 1,
|
|
3072
|
+
minWidth: 0,
|
|
3073
|
+
overflow: 'hidden',
|
|
3074
|
+
textOverflow: 'ellipsis',
|
|
3075
|
+
whiteSpace: 'nowrap',
|
|
3076
|
+
fontFamily: theme.fonts.monospace,
|
|
3077
|
+
fontSize: theme.fontSizes[0],
|
|
3078
|
+
color: theme.colors.textMuted ?? theme.colors.textSecondary,
|
|
3079
|
+
}}
|
|
3080
|
+
>
|
|
3081
|
+
{fileOverlay.file}
|
|
3082
|
+
</span>
|
|
3083
|
+
<FileOverlayCloseButton onClose={closeFileOverlay} />
|
|
3084
|
+
</div>
|
|
3085
|
+
<div style={{ flex: 1, minHeight: 0, overflow: 'auto' }}>
|
|
3086
|
+
<FileDrawerContent
|
|
3087
|
+
render={renderDrawerContent}
|
|
3088
|
+
file={fileOverlay.file}
|
|
3089
|
+
startLine={fileOverlay.startLine}
|
|
3090
|
+
endLine={fileOverlay.endLine}
|
|
3091
|
+
fullFile
|
|
3092
|
+
/>
|
|
3093
|
+
</div>
|
|
3094
|
+
</div>
|
|
3095
|
+
);
|
|
3096
|
+
|
|
3044
3097
|
return (
|
|
3045
3098
|
<GraphWithSidebar
|
|
3046
3099
|
hidden={!sidebarVisible}
|
|
@@ -3063,7 +3116,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3063
3116
|
onResizeEnd={() => requestAnimationFrame(() => fitView())}
|
|
3064
3117
|
>
|
|
3065
3118
|
{/* Graph area */}
|
|
3066
|
-
<div style={{ flex: 1, position: 'relative', display: 'flex', flexDirection: 'column', minHeight: 0 }}>
|
|
3119
|
+
<div style={{ flex: 1, position: 'relative', display: 'flex', flexDirection: committedDirection === 'vertical' ? 'row' : 'column', minHeight: 0, minWidth: 0 }}>
|
|
3067
3120
|
{/* Canvas box — the edge-label overlay and legend anchor here, so
|
|
3068
3121
|
overlays shift with the canvas, not the labels. Collapses when the
|
|
3069
3122
|
file drawer fills the column (whole-file reading). */}
|
|
@@ -3073,6 +3126,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3073
3126
|
position: 'relative',
|
|
3074
3127
|
flex: collapseCanvas ? 0 : 1,
|
|
3075
3128
|
minHeight: 0,
|
|
3129
|
+
minWidth: 0,
|
|
3076
3130
|
height: collapseCanvas ? 0 : undefined,
|
|
3077
3131
|
overflow: 'hidden',
|
|
3078
3132
|
display: 'flex',
|
|
@@ -3537,10 +3591,14 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3537
3591
|
/>
|
|
3538
3592
|
</div>
|
|
3539
3593
|
)}
|
|
3594
|
+
{/* Vertical full-file reading replaces only the graph, not either left column. */}
|
|
3595
|
+
{committedDirection === 'vertical' && fileOverlayView}
|
|
3540
3596
|
</div>
|
|
3541
3597
|
<FileDrawer
|
|
3542
3598
|
title={drawerTitle}
|
|
3543
3599
|
onClose={closeDrawer}
|
|
3600
|
+
placement={committedDirection === 'vertical' ? 'left' : 'bottom'}
|
|
3601
|
+
onResizeEnd={() => requestAnimationFrame(() => fitView())}
|
|
3544
3602
|
fillHeight={drawerFillHeight}
|
|
3545
3603
|
suppressEscape={fileOverlayOpen}
|
|
3546
3604
|
hidden={hideDrawer}
|
|
@@ -3579,56 +3637,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3579
3637
|
/>
|
|
3580
3638
|
) : null}
|
|
3581
3639
|
</FileDrawer>
|
|
3582
|
-
{
|
|
3583
|
-
<div
|
|
3584
|
-
style={{
|
|
3585
|
-
position: 'absolute',
|
|
3586
|
-
inset: 0,
|
|
3587
|
-
zIndex: 8,
|
|
3588
|
-
display: 'flex',
|
|
3589
|
-
flexDirection: 'column',
|
|
3590
|
-
background: theme.colors.background,
|
|
3591
|
-
borderLeft: `1px solid ${theme.colors.border}`,
|
|
3592
|
-
}}
|
|
3593
|
-
>
|
|
3594
|
-
<div
|
|
3595
|
-
style={{
|
|
3596
|
-
display: 'flex',
|
|
3597
|
-
alignItems: 'center',
|
|
3598
|
-
gap: 8,
|
|
3599
|
-
padding: '6px 10px',
|
|
3600
|
-
borderBottom: `1px solid ${theme.colors.border}`,
|
|
3601
|
-
flexShrink: 0,
|
|
3602
|
-
}}
|
|
3603
|
-
>
|
|
3604
|
-
<span
|
|
3605
|
-
title={fileOverlay.file}
|
|
3606
|
-
style={{
|
|
3607
|
-
flex: 1,
|
|
3608
|
-
minWidth: 0,
|
|
3609
|
-
overflow: 'hidden',
|
|
3610
|
-
textOverflow: 'ellipsis',
|
|
3611
|
-
whiteSpace: 'nowrap',
|
|
3612
|
-
fontFamily: theme.fonts.monospace,
|
|
3613
|
-
fontSize: theme.fontSizes[0],
|
|
3614
|
-
color: theme.colors.textMuted ?? theme.colors.textSecondary,
|
|
3615
|
-
}}
|
|
3616
|
-
>
|
|
3617
|
-
{fileOverlay.file}
|
|
3618
|
-
</span>
|
|
3619
|
-
<FileOverlayCloseButton onClose={closeFileOverlay} />
|
|
3620
|
-
</div>
|
|
3621
|
-
<div style={{ flex: 1, minHeight: 0, overflow: 'auto' }}>
|
|
3622
|
-
<FileDrawerContent
|
|
3623
|
-
render={renderDrawerContent}
|
|
3624
|
-
file={fileOverlay.file}
|
|
3625
|
-
startLine={fileOverlay.startLine}
|
|
3626
|
-
endLine={fileOverlay.endLine}
|
|
3627
|
-
fullFile
|
|
3628
|
-
/>
|
|
3629
|
-
</div>
|
|
3630
|
-
</div>
|
|
3631
|
-
)}
|
|
3640
|
+
{committedDirection !== 'vertical' && fileOverlayView}
|
|
3632
3641
|
{/* Startup cover — hides measurement, layout swap, and camera settle.
|
|
3633
3642
|
Kept away during a direction flip: the flip is meant to be watched,
|
|
3634
3643
|
and the cover would swallow the node slide. */}
|