@principal-ai/subsystems-react 0.56.25 → 0.56.26
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/C4ProjectionView.d.ts +12 -2
- package/dist/subsystem/C4ProjectionView.d.ts.map +1 -1
- package/dist/subsystem/C4ProjectionView.js +22 -9
- package/dist/subsystem/C4ProjectionView.js.map +1 -1
- package/dist/subsystem/ConstructsCatalog.d.ts +18 -11
- package/dist/subsystem/ConstructsCatalog.d.ts.map +1 -1
- package/dist/subsystem/ConstructsCatalog.js +25 -27
- package/dist/subsystem/ConstructsCatalog.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +13 -3
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +17 -6
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/__fixtures__/c4SketchGallery.d.ts +2 -0
- package/dist/subsystem/__fixtures__/c4SketchGallery.d.ts.map +1 -1
- package/dist/subsystem/__fixtures__/c4SketchGallery.js +8 -0
- package/dist/subsystem/__fixtures__/c4SketchGallery.js.map +1 -1
- package/dist/subsystem/__fixtures__/c4Sketches/maintenance-bridge.json +2 -1
- package/dist/subsystem/__fixtures__/c4Sketches/openbot.json +2 -1
- package/package.json +1 -1
- package/src/stories/Canvases/C4/C4Sketch.stories.tsx +6 -0
- package/src/stories/Canvases/Subsystem/ContainerFrames.stories.tsx +6 -3
- package/src/stories/Canvases/Subsystem/CustomEntities.stories.tsx +2 -1
- package/src/stories/Canvases/Subsystem/EdgeViews.stories.tsx +2 -1
- package/src/stories/Canvases/Subsystem/Issues.stories.tsx +2 -1
- package/src/stories/Canvases/Subsystem/ModuleBadges.stories.tsx +3 -2
- package/src/stories/Canvases/Subsystem/Processes.stories.tsx +2 -1
- package/src/stories/Canvases/Subsystem/Reorder.stories.tsx +2 -1
- package/src/stories/Canvases/Subsystem/Scenarios.stories.tsx +6 -3
- package/src/stories/Canvases/Subsystem/TrailAutoplay.stories.tsx +2 -1
- package/src/stories/Canvases/Subsystem/Trails.stories.tsx +4 -2
- package/src/stories/Components/ConstructsCatalog.stories.tsx +2 -1
- package/src/subsystem/C4ProjectionView.tsx +44 -16
- package/src/subsystem/ConstructsCatalog.tsx +59 -58
- package/src/subsystem/DescriptionOverlay.test.tsx +16 -8
- package/src/subsystem/SubsystemComponentGraph.sidebar.test.tsx +27 -7
- package/src/subsystem/SubsystemComponentGraph.tsx +38 -14
- package/src/subsystem/__fixtures__/c4SketchGallery.ts +10 -0
- package/src/subsystem/__fixtures__/c4Sketches/maintenance-bridge.json +2 -1
- package/src/subsystem/__fixtures__/c4Sketches/openbot.json +2 -1
|
@@ -24,7 +24,7 @@ globals.matchMedia = dom.matchMedia.bind(dom);
|
|
|
24
24
|
|
|
25
25
|
afterEach(cleanup);
|
|
26
26
|
|
|
27
|
-
function renderGraph(description: string | undefined) {
|
|
27
|
+
function renderGraph(description: string | undefined, notes?: string) {
|
|
28
28
|
return render(createElement(
|
|
29
29
|
ThemeProvider,
|
|
30
30
|
{ theme: defaultEditorTheme },
|
|
@@ -39,21 +39,23 @@ function renderGraph(description: string | undefined) {
|
|
|
39
39
|
steps: [{ from: 'entry', to: 'store', mechanism: 'calls' }],
|
|
40
40
|
}],
|
|
41
41
|
description,
|
|
42
|
+
notes,
|
|
42
43
|
}),
|
|
43
44
|
));
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
describe('subsystem description overlay', () => {
|
|
47
48
|
for (const closeWithEscape of [false, true]) {
|
|
48
|
-
test(`More opens the full
|
|
49
|
-
const
|
|
50
|
-
const view = renderGraph(description);
|
|
49
|
+
test(`More opens the full notes over the graph and closes with ${closeWithEscape ? 'Escape' : 'the close button'}`, () => {
|
|
50
|
+
const notes = `${'A long note. '.repeat(50)}\n\n**Final detail**`;
|
|
51
|
+
const view = renderGraph('Short description.', notes);
|
|
51
52
|
const more = view.getByRole('button', { name: 'Read full description' });
|
|
52
53
|
more.focus();
|
|
53
54
|
fireEvent.click(more);
|
|
54
|
-
const overlay = view.getByRole('dialog', { name: 'Subsystem
|
|
55
|
-
expect(overlay.textContent).toContain('A long
|
|
55
|
+
const overlay = view.getByRole('dialog', { name: 'Subsystem notes' });
|
|
56
|
+
expect(overlay.textContent).toContain('A long note. '.repeat(50).trim());
|
|
56
57
|
expect(overlay.querySelector('strong')?.textContent).toBe('Final detail');
|
|
58
|
+
expect(overlay.textContent).not.toContain('Short description.');
|
|
57
59
|
expect(overlay.style.position).toBe('absolute');
|
|
58
60
|
expect(overlay.parentElement?.contains(view.getByLabelText('Resize sidebar'))).toBe(false);
|
|
59
61
|
expect(more.getAttribute('aria-expanded')).toBe('true');
|
|
@@ -70,9 +72,15 @@ describe('subsystem description overlay', () => {
|
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
test('does not offer More when there
|
|
74
|
-
const view = renderGraph(
|
|
75
|
+
test('does not offer More when there are no notes', () => {
|
|
76
|
+
const view = renderGraph('Short description only.');
|
|
75
77
|
expect(view.queryByRole('button', { name: 'Read full description' })).toBeNull();
|
|
76
78
|
expect(view.queryByRole('dialog')).toBeNull();
|
|
77
79
|
});
|
|
80
|
+
|
|
81
|
+
test('falls back to a clamped notes preview when there is no description', () => {
|
|
82
|
+
const view = renderGraph(undefined, `${'A long note. '.repeat(50)}\n\n**Final detail**`);
|
|
83
|
+
expect(view.getByRole('button', { name: 'Read full description' })).toBeTruthy();
|
|
84
|
+
expect(view.queryByRole('dialog')).toBeNull();
|
|
85
|
+
});
|
|
78
86
|
});
|
|
@@ -61,19 +61,39 @@ describe('subsystem graph sidebar', () => {
|
|
|
61
61
|
expect(content?.textContent).not.toContain('Request subsystem');
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
test('
|
|
64
|
+
test('shows the short description unclamped and without a notes link', () => {
|
|
65
65
|
const body = renderGraph();
|
|
66
|
-
const description = body.querySelector('[style*="-webkit-line-clamp:6"]') as HTMLElement;
|
|
67
|
-
expect(description).
|
|
68
|
-
expect(
|
|
69
|
-
expect(
|
|
70
|
-
expect(
|
|
66
|
+
const description = body.querySelector('[style*="-webkit-line-clamp:6"]') as HTMLElement | null;
|
|
67
|
+
expect(description).toBeNull();
|
|
68
|
+
expect(body.textContent).toContain('Always visible description.');
|
|
69
|
+
expect(body.querySelector('button[aria-label="Read full description"]')).toBeNull();
|
|
70
|
+
expect(body.querySelector('[role="dialog"]')).toBeNull();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('offers the extended notes from the short description', () => {
|
|
74
|
+
const body = renderGraph({
|
|
75
|
+
notes: '## Extended\n\nLonger **context**.',
|
|
76
|
+
});
|
|
77
|
+
expect(body.textContent).toContain('Always visible description.');
|
|
78
|
+
expect(body.textContent).not.toContain('Longer context.');
|
|
71
79
|
const more = body.querySelector('button[aria-label="Read full description"]');
|
|
72
80
|
expect(more?.textContent).toBe('Show more');
|
|
73
81
|
expect(more?.getAttribute('aria-haspopup')).toBe('dialog');
|
|
74
82
|
expect(more?.getAttribute('aria-expanded')).toBe('false');
|
|
75
83
|
expect(body.querySelector('[role="dialog"]')).toBeNull();
|
|
76
|
-
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('falls back to a clamped notes preview when there is no description', () => {
|
|
87
|
+
const body = renderGraph({
|
|
88
|
+
description: undefined,
|
|
89
|
+
notes: '## Extended\n\nLonger **context**.',
|
|
90
|
+
});
|
|
91
|
+
const preview = body.querySelector('[style*="-webkit-line-clamp:6"]') as HTMLElement;
|
|
92
|
+
expect(preview).not.toBeNull();
|
|
93
|
+
expect(preview.textContent).toContain('Extended');
|
|
94
|
+
expect(preview.style.overflow).toBe('hidden');
|
|
95
|
+
expect(preview.style.maxHeight).toBe('9em');
|
|
96
|
+
expect(body.querySelector('button[aria-label="Read full description"]')?.textContent).toBe('Show more');
|
|
77
97
|
});
|
|
78
98
|
|
|
79
99
|
test('keeps the Files button in the header when no name is provided', () => {
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
applyNodeChanges,
|
|
33
33
|
} from '@xyflow/react';
|
|
34
34
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
35
|
+
import { SUBSYSTEM_MODEL_DESCRIPTION_MAX } from '@principal-ai/subsystems-core';
|
|
35
36
|
import { ArrowDown, ArrowRight, Boxes, Files, Route, Unlink, X } from 'lucide-react';
|
|
36
37
|
import {
|
|
37
38
|
buildSubsystemGraph,
|
|
@@ -408,11 +409,21 @@ export interface SubsystemComponentGraphProps {
|
|
|
408
409
|
* Uses the focused or hover-highlighted trail.
|
|
409
410
|
*/
|
|
410
411
|
showTrailTitle?: boolean;
|
|
411
|
-
/**
|
|
412
|
+
/**
|
|
413
|
+
* Short description rendered at the top of the sidebar. At most 200
|
|
414
|
+
* characters; extended detail belongs in `notes`.
|
|
415
|
+
*/
|
|
412
416
|
description?: string;
|
|
413
417
|
/**
|
|
414
|
-
*
|
|
415
|
-
*
|
|
418
|
+
* Extended Markdown notes about the model. When set, the description's
|
|
419
|
+
* `Show more` link opens the full document in an Overview overlay. Omit
|
|
420
|
+
* `description` and the sidebar falls back to a clamped preview of these
|
|
421
|
+
* notes.
|
|
422
|
+
*/
|
|
423
|
+
notes?: string;
|
|
424
|
+
/**
|
|
425
|
+
* Controlled open state for the notes overlay. When provided, the host owns
|
|
426
|
+
* it (e.g. a button in its own header).
|
|
416
427
|
*/
|
|
417
428
|
descriptionOpen?: boolean;
|
|
418
429
|
onDescriptionOpenChange?: (open: boolean) => void;
|
|
@@ -698,10 +709,21 @@ interface InnerProps extends SubsystemComponentGraphProps {
|
|
|
698
709
|
onSidebarTrailChange: (trailId: string | null) => void;
|
|
699
710
|
}
|
|
700
711
|
|
|
701
|
-
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, 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 = true, containersActive, hideDrawer = false, persistKey, liveEvents, agentsPanel }: InnerProps) {
|
|
712
|
+
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 = true, containersActive, hideDrawer = false, persistKey, liveEvents, agentsPanel }: InnerProps) {
|
|
702
713
|
const { theme } = useTheme();
|
|
703
714
|
const { fitView, fitBounds } = useReactFlow();
|
|
704
715
|
const [descriptionOpen, setDescriptionOpen] = useState(false);
|
|
716
|
+
const rawDescription = description?.trim();
|
|
717
|
+
// The host caps the authored description; trim defensively for other hosts.
|
|
718
|
+
const shortDescription =
|
|
719
|
+
rawDescription && rawDescription.length > SUBSYSTEM_MODEL_DESCRIPTION_MAX
|
|
720
|
+
? `${rawDescription.slice(0, SUBSYSTEM_MODEL_DESCRIPTION_MAX - 1)}…`
|
|
721
|
+
: rawDescription;
|
|
722
|
+
const extendedNotes = notes?.trim();
|
|
723
|
+
// The short description owns the top-left slot; a legacy model with only
|
|
724
|
+
// notes falls back to a clamped preview of them.
|
|
725
|
+
const descriptionPreview = shortDescription || extendedNotes;
|
|
726
|
+
const hasNotes = Boolean(extendedNotes);
|
|
705
727
|
const viewport = useViewport();
|
|
706
728
|
// Restored once per mount from `localStorage` (see `readViewState`). Each
|
|
707
729
|
// graph is its own tab/mount, so `persistKey` is stable for a mount.
|
|
@@ -2975,7 +2997,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2975
2997
|
// the same facts the sidebar renders.
|
|
2976
2998
|
const sidebarVisible =
|
|
2977
2999
|
!hideSidebar &&
|
|
2978
|
-
(
|
|
3000
|
+
(descriptionPreview || filesActive || containersActive || issuesActive || sidebarExtra || sidebarAfterDescription ||
|
|
2979
3001
|
hasTrails);
|
|
2980
3002
|
const sidebarBodyVisible = hasTrails || filesActive || containersActive || issuesActive;
|
|
2981
3003
|
const sidebarTabs: GraphSidebarTab[] | undefined = issuesActive && !sidebarTrail
|
|
@@ -2986,16 +3008,17 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
2986
3008
|
]
|
|
2987
3009
|
: undefined
|
|
2988
3010
|
: undefined;
|
|
2989
|
-
// Header block: extras, then the description.
|
|
3011
|
+
// Header block: extras, then the short description.
|
|
2990
3012
|
const sidebarHeader = (
|
|
2991
3013
|
<>
|
|
2992
3014
|
{sidebarExtra}
|
|
2993
|
-
{
|
|
3015
|
+
{descriptionPreview && (
|
|
2994
3016
|
<DescriptionPreview
|
|
2995
|
-
content={
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3017
|
+
content={descriptionPreview}
|
|
3018
|
+
clamp={!shortDescription}
|
|
3019
|
+
open={hasNotes && descriptionOpen}
|
|
3020
|
+
onOpen={hasNotes ? () => setDescriptionOpen(true) : undefined}
|
|
3021
|
+
onClose={hasNotes ? () => setDescriptionOpen(false) : undefined}
|
|
2999
3022
|
slideIdPrefix="subsystem-desc"
|
|
3000
3023
|
/>
|
|
3001
3024
|
)}
|
|
@@ -3143,10 +3166,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
3143
3166
|
persistKey={persistKey}
|
|
3144
3167
|
onResizeEnd={() => requestAnimationFrame(() => fitView())}
|
|
3145
3168
|
>
|
|
3146
|
-
{!hideSidebar &&
|
|
3169
|
+
{!hideSidebar && hasNotes && descriptionOpen && (
|
|
3147
3170
|
<DescriptionOverlay
|
|
3148
|
-
description={
|
|
3149
|
-
ariaLabel="Subsystem
|
|
3171
|
+
description={extendedNotes ?? ''}
|
|
3172
|
+
ariaLabel="Subsystem notes"
|
|
3150
3173
|
slideIdPrefix="subsystem-desc-overlay"
|
|
3151
3174
|
onClose={() => setDescriptionOpen(false)}
|
|
3152
3175
|
/>
|
|
@@ -3893,6 +3916,7 @@ export function SubsystemComponentGraph(props: SubsystemComponentGraphProps) {
|
|
|
3893
3916
|
title={props.title}
|
|
3894
3917
|
hideSidebar={props.hideSidebar}
|
|
3895
3918
|
description={props.description}
|
|
3919
|
+
notes={props.notes}
|
|
3896
3920
|
descriptionOpen={props.descriptionOpen}
|
|
3897
3921
|
onDescriptionOpenChange={props.onDescriptionOpenChange}
|
|
3898
3922
|
diagnostic={props.diagnostic}
|
|
@@ -349,3 +349,13 @@ export const OPENBOT_SKETCH = openbot as unknown as C4Sketch;
|
|
|
349
349
|
|
|
350
350
|
/** The real Studio → OpenBot maintenance bridge sketch (6 containers). */
|
|
351
351
|
export const MAINTENANCE_BRIDGE_SKETCH = maintenanceBridge as unknown as C4Sketch;
|
|
352
|
+
|
|
353
|
+
/** Legacy shape: notes only, no short description (tests the fallback preview). */
|
|
354
|
+
export const NOTES_ONLY_SKETCH: C4Sketch = {
|
|
355
|
+
...STUDIO_SKETCH,
|
|
356
|
+
id: 'c4s-gallery-notes-only',
|
|
357
|
+
title: 'Notes only — no description',
|
|
358
|
+
description: undefined,
|
|
359
|
+
notes:
|
|
360
|
+
'## About this sketch\n\nThis sketch has no short description. The sidebar falls back to a clamped preview of these notes, and **Show more** opens the full Markdown in the Overview overlay.\n\n- Use this story to check the legacy shape.\n- Existing sketches with only `notes` keep working.',
|
|
361
|
+
};
|
|
@@ -773,5 +773,6 @@
|
|
|
773
773
|
"author": "opencode",
|
|
774
774
|
"notes": "Top-down C4 sketch for topic topic-1792962278647-rghcszfxe: Studio → OpenBot maintenance progress card and signed completion delivery. The linked model is the existing reuse-first bridge proposal, not live integration evidence.",
|
|
775
775
|
"createdAt": "2026-10-25T21:10:30.873Z",
|
|
776
|
-
"updatedAt": "2026-10-25T21:10:30.873Z"
|
|
776
|
+
"updatedAt": "2026-10-25T21:10:30.873Z",
|
|
777
|
+
"description": "A Studio → OpenBot bridge hypothesis: maintenance progress cards in the renderer, signed completion delivery from the host, and both sides’ stores and services."
|
|
777
778
|
}
|
|
@@ -882,5 +882,6 @@
|
|
|
882
882
|
"author": "opencode",
|
|
883
883
|
"notes": "Top-down C4 sketch authored from the OpenBot README, docs/architecture.md, package layout, and docker-compose services.",
|
|
884
884
|
"createdAt": "2026-10-25T20:17:44.365Z",
|
|
885
|
-
"updatedAt": "2026-10-25T20:17:44.365Z"
|
|
885
|
+
"updatedAt": "2026-10-25T20:17:44.365Z",
|
|
886
|
+
"description": "Top-down architecture for OpenBot: browser and server containers, routines and computer workers, agent bots, PostgreSQL + pgvector, and the desktop and mobile clients."
|
|
886
887
|
}
|