@principal-ai/principal-view-react 0.16.53 → 0.16.55
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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pierre/PierreFileView.d.ts +16 -0
- package/dist/pierre/PierreFileView.d.ts.map +1 -0
- package/dist/pierre/PierreFileView.js +43 -0
- package/dist/pierre/PierreFileView.js.map +1 -0
- package/dist/pierre/PierreSnippetView.d.ts +27 -0
- package/dist/pierre/PierreSnippetView.d.ts.map +1 -0
- package/dist/pierre/PierreSnippetView.js +98 -0
- package/dist/pierre/PierreSnippetView.js.map +1 -0
- package/dist/pierre/index.d.ts +7 -0
- package/dist/pierre/index.d.ts.map +1 -0
- package/dist/pierre/index.js +4 -0
- package/dist/pierre/index.js.map +1 -0
- package/dist/pierre/pierreBackground.d.ts +15 -0
- package/dist/pierre/pierreBackground.d.ts.map +1 -0
- package/dist/pierre/pierreBackground.js +31 -0
- package/dist/pierre/pierreBackground.js.map +1 -0
- package/dist/pierre/scrollAnchor.d.ts +5 -0
- package/dist/pierre/scrollAnchor.d.ts.map +1 -0
- package/dist/pierre/scrollAnchor.js +9 -0
- package/dist/pierre/scrollAnchor.js.map +1 -0
- package/dist/pierre/sliceSnippet.d.ts +10 -0
- package/dist/pierre/sliceSnippet.d.ts.map +1 -0
- package/dist/pierre/sliceSnippet.js +16 -0
- package/dist/pierre/sliceSnippet.js.map +1 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +11 -4
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/model.d.ts +2 -0
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js +12 -0
- package/dist/subsystem/model.js.map +1 -1
- package/package.json +3 -1
- package/src/index.ts +8 -0
- package/src/pierre/PierreFileView.tsx +77 -0
- package/src/pierre/PierreSnippetView.tsx +176 -0
- package/src/pierre/index.ts +6 -0
- package/src/pierre/pierreBackground.ts +33 -0
- package/src/pierre/scrollAnchor.test.ts +13 -0
- package/src/pierre/scrollAnchor.ts +11 -0
- package/src/pierre/sliceSnippet.test.ts +21 -0
- package/src/pierre/sliceSnippet.ts +31 -0
- package/src/stories/SubsystemComponentGraph.stories.tsx +96 -0
- package/src/subsystem/SubsystemComponentGraph.tsx +15 -3
- package/src/subsystem/model.test.ts +22 -0
- package/src/subsystem/model.ts +16 -0
package/dist/subsystem/model.js
CHANGED
|
@@ -210,6 +210,18 @@ export function convertSubsystemToEdges(doc) {
|
|
|
210
210
|
}
|
|
211
211
|
return edges;
|
|
212
212
|
}
|
|
213
|
+
/** Stable key for layout-affecting graph fields (ignores declarationRef, etc.). */
|
|
214
|
+
export function subsystemGraphLayoutKey(doc) {
|
|
215
|
+
const components = doc.components
|
|
216
|
+
.map(({ id, purl, name, symbol, kind, file, purpose }) => [id, purl, name, symbol ?? '', kind, file, purpose ?? ''].join('\0'))
|
|
217
|
+
.sort()
|
|
218
|
+
.join('\n');
|
|
219
|
+
const edgeKey = doc.edges
|
|
220
|
+
.map(({ id, from, to, mechanism }) => [id, from, to, mechanism].join('\0'))
|
|
221
|
+
.sort()
|
|
222
|
+
.join('\n');
|
|
223
|
+
return `${components}|${edgeKey}`;
|
|
224
|
+
}
|
|
213
225
|
/**
|
|
214
226
|
* Build the full React Flow graph (nodes + edges) using **ELK auto-layout** to
|
|
215
227
|
* position every node (including external stub targets), so the graph is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/subsystem/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,UAAU,GAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAiHtD;;;;;;;;;;GAUG;AACH,MA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,EAAE;QACrB,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,GAAG,EAAE;YACP,MAAM,CAAC,GAAI,CAAwB,CAAC,IAA8B,CAAC;YACnE,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;YACjB,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;SAClB;QACD,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtC,IAAI,IAAI,EAAE;YACR,MAAM,CAAC,GAAI,CAAwB,CAAC,IAA8B,CAAC;YACnE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;SAClB;KACF;IAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ai/principal-view-react",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.55",
|
|
4
4
|
"description": "React components for graph-based principal view framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -33,12 +33,14 @@
|
|
|
33
33
|
"zustand": "4.5.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
+
"@pierre/diffs": ">=1.1.20",
|
|
36
37
|
"@principal-ade/industry-theme": "^0.1.7",
|
|
37
38
|
"@principal-ai/principal-view-core": ">=0.27.0",
|
|
38
39
|
"react": "^18.0.0 || ^19.0.0",
|
|
39
40
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
43
|
+
"@pierre/diffs": "^1.3.0",
|
|
42
44
|
"@principal-ade/industry-theme": "0.1.7",
|
|
43
45
|
"@principal-ai/agent-monitoring": "^0.3.38",
|
|
44
46
|
"@principal-ai/principal-view-core": "0.27.1",
|
package/src/index.ts
CHANGED
|
@@ -316,3 +316,11 @@ export {
|
|
|
316
316
|
extractDeclarationLine,
|
|
317
317
|
DECLARATION_HASH_ALGO,
|
|
318
318
|
} from './subsystem/declarationRef';
|
|
319
|
+
|
|
320
|
+
// Pierre code views (@pierre/diffs wrappers)
|
|
321
|
+
export { PierreFileView, PierreSnippetView, sliceSnippetWindow } from './pierre';
|
|
322
|
+
export type {
|
|
323
|
+
PierreFileViewProps,
|
|
324
|
+
PierreSnippetViewProps,
|
|
325
|
+
SnippetSlice,
|
|
326
|
+
} from './pierre';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PierreFileView — host-injected full-file code view via `@pierre/diffs`.
|
|
3
|
+
*
|
|
4
|
+
* Ported from `@industry-theme/file-city-panel` so subsystem graphs and
|
|
5
|
+
* Storybook can render source without that panel package.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { File } from '@pierre/diffs/react';
|
|
10
|
+
import { useTheme } from '@principal-ade/industry-theme';
|
|
11
|
+
import { buildPierreOptions, PIERRE_FILE_STYLE } from './pierreBackground';
|
|
12
|
+
|
|
13
|
+
export interface PierreFileViewProps {
|
|
14
|
+
filePath: string;
|
|
15
|
+
fileName: string;
|
|
16
|
+
/** Host-supplied file reader (closures bind any path-normalization). */
|
|
17
|
+
readFile: (path: string) => Promise<string>;
|
|
18
|
+
/** Override Pierre's container background. Any CSS color string. */
|
|
19
|
+
background?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function PierreFileView({
|
|
23
|
+
filePath,
|
|
24
|
+
fileName,
|
|
25
|
+
readFile,
|
|
26
|
+
background,
|
|
27
|
+
}: PierreFileViewProps) {
|
|
28
|
+
const { theme } = useTheme();
|
|
29
|
+
const [contents, setContents] = useState<string | null>(null);
|
|
30
|
+
const [error, setError] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const fileObject = useMemo(
|
|
33
|
+
() => (contents !== null ? { name: fileName, contents } : null),
|
|
34
|
+
[fileName, contents],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let cancelled = false;
|
|
39
|
+
setContents(null);
|
|
40
|
+
setError(null);
|
|
41
|
+
void readFile(filePath)
|
|
42
|
+
.then((content) => {
|
|
43
|
+
if (!cancelled) setContents(content);
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
if (!cancelled) {
|
|
47
|
+
setError(err instanceof Error ? err.message : 'Failed to read file');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return () => {
|
|
51
|
+
cancelled = true;
|
|
52
|
+
};
|
|
53
|
+
}, [filePath, readFile]);
|
|
54
|
+
|
|
55
|
+
if (error) {
|
|
56
|
+
return (
|
|
57
|
+
<div style={{ padding: 16, color: theme.colors.error ?? '#e5534b' }}>
|
|
58
|
+
{error}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (fileObject === null) {
|
|
63
|
+
return (
|
|
64
|
+
<div style={{ padding: 16, color: theme.colors.textSecondary }}>
|
|
65
|
+
Loading…
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<File
|
|
72
|
+
file={fileObject}
|
|
73
|
+
options={buildPierreOptions(background)}
|
|
74
|
+
style={PIERRE_FILE_STYLE}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PierreSnippetView — focused line-range code view via `@pierre/diffs`.
|
|
3
|
+
*
|
|
4
|
+
* Ported from `@industry-theme/file-city-panel` so subsystem graphs and
|
|
5
|
+
* Storybook can scroll to a declaration line without that panel package.
|
|
6
|
+
*
|
|
7
|
+
* `File.selectedLines` highlights the focus line but does not scroll; we call
|
|
8
|
+
* `scrollIntoView` on the rendered line after Pierre paints.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import { File } from '@pierre/diffs/react';
|
|
13
|
+
import { useTheme } from '@principal-ade/industry-theme';
|
|
14
|
+
import { buildPierreOptions, PIERRE_FILE_STYLE } from './pierreBackground';
|
|
15
|
+
import { sliceSnippetWindow } from './sliceSnippet';
|
|
16
|
+
|
|
17
|
+
import { scrollAnchorLine } from './scrollAnchor';
|
|
18
|
+
|
|
19
|
+
function scrollFocusLineIntoView(
|
|
20
|
+
fileContainer: HTMLElement,
|
|
21
|
+
focusOffset: number,
|
|
22
|
+
): void {
|
|
23
|
+
const root = fileContainer.shadowRoot ?? fileContainer;
|
|
24
|
+
const anchorLine = scrollAnchorLine(focusOffset);
|
|
25
|
+
const lineEl = root.querySelector(
|
|
26
|
+
`[data-line="${anchorLine}"]`,
|
|
27
|
+
) as HTMLElement | null;
|
|
28
|
+
lineEl?.scrollIntoView({ block: 'start', behavior: 'auto' });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PierreSnippetViewProps {
|
|
32
|
+
filePath: string;
|
|
33
|
+
fileName: string;
|
|
34
|
+
/** First line of the snippet (1-based, inclusive). */
|
|
35
|
+
startLine: number;
|
|
36
|
+
/** Last line of the snippet (1-based, inclusive). */
|
|
37
|
+
endLine: number;
|
|
38
|
+
/** Line to call out as the focus point; defaults to `startLine`. */
|
|
39
|
+
focusLine?: number;
|
|
40
|
+
/** Lines of context above/below the snippet; defaults to 2. */
|
|
41
|
+
contextLines?: number;
|
|
42
|
+
/** Host-supplied file reader. */
|
|
43
|
+
readFile: (path: string) => Promise<string>;
|
|
44
|
+
/** Override Pierre's container background. Any CSS color string. */
|
|
45
|
+
background?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function PierreSnippetView({
|
|
49
|
+
filePath,
|
|
50
|
+
fileName,
|
|
51
|
+
startLine,
|
|
52
|
+
endLine,
|
|
53
|
+
focusLine,
|
|
54
|
+
contextLines = 2,
|
|
55
|
+
readFile,
|
|
56
|
+
background,
|
|
57
|
+
}: PierreSnippetViewProps) {
|
|
58
|
+
const { theme } = useTheme();
|
|
59
|
+
const [contents, setContents] = useState<string | null>(null);
|
|
60
|
+
const [error, setError] = useState<string | null>(null);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
let cancelled = false;
|
|
64
|
+
setContents(null);
|
|
65
|
+
setError(null);
|
|
66
|
+
void readFile(filePath)
|
|
67
|
+
.then((content) => {
|
|
68
|
+
if (!cancelled) setContents(content);
|
|
69
|
+
})
|
|
70
|
+
.catch((err) => {
|
|
71
|
+
if (!cancelled) {
|
|
72
|
+
setError(err instanceof Error ? err.message : 'Failed to read file');
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return () => {
|
|
76
|
+
cancelled = true;
|
|
77
|
+
};
|
|
78
|
+
}, [filePath, readFile]);
|
|
79
|
+
|
|
80
|
+
const slice = useMemo(() => {
|
|
81
|
+
if (contents == null) return null;
|
|
82
|
+
return sliceSnippetWindow(
|
|
83
|
+
contents,
|
|
84
|
+
startLine,
|
|
85
|
+
endLine,
|
|
86
|
+
contextLines,
|
|
87
|
+
focusLine ?? startLine,
|
|
88
|
+
);
|
|
89
|
+
}, [contents, startLine, endLine, contextLines, focusLine]);
|
|
90
|
+
|
|
91
|
+
const fileObject = useMemo(
|
|
92
|
+
() => (slice ? { name: fileName, contents: slice.contents } : null),
|
|
93
|
+
[fileName, slice],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const lineNumberOffset = slice ? slice.sliceStart - 1 : 0;
|
|
97
|
+
|
|
98
|
+
const onPostRender = useCallback(
|
|
99
|
+
(fileContainer: HTMLElement) => {
|
|
100
|
+
if (lineNumberOffset !== 0) {
|
|
101
|
+
const root = fileContainer.shadowRoot ?? fileContainer;
|
|
102
|
+
const items = root.querySelectorAll('[data-column-number][data-line-index]');
|
|
103
|
+
items.forEach((el) => {
|
|
104
|
+
const idxStr = (el as HTMLElement).dataset.lineIndex;
|
|
105
|
+
if (idxStr == null) return;
|
|
106
|
+
const idx = Number.parseInt(idxStr, 10);
|
|
107
|
+
if (Number.isNaN(idx)) return;
|
|
108
|
+
const display = String(idx + 1 + lineNumberOffset);
|
|
109
|
+
const span = el.querySelector('[data-line-number-content]');
|
|
110
|
+
if (span && span.textContent !== display) {
|
|
111
|
+
span.textContent = display;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (slice?.focusOffset != null) {
|
|
116
|
+
scrollFocusLineIntoView(fileContainer, slice.focusOffset);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
[lineNumberOffset, slice?.focusOffset],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const options = useMemo(
|
|
123
|
+
() => ({
|
|
124
|
+
...buildPierreOptions(background),
|
|
125
|
+
onPostRender,
|
|
126
|
+
}),
|
|
127
|
+
[background, onPostRender],
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
if (error) {
|
|
131
|
+
return (
|
|
132
|
+
<div style={{ padding: 16, color: theme.colors.error ?? '#e5534b' }}>
|
|
133
|
+
{error}
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
if (!fileObject || !slice) {
|
|
138
|
+
return (
|
|
139
|
+
<div style={{ padding: 16, color: theme.colors.textSecondary }}>
|
|
140
|
+
Loading…
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const rangeLabel =
|
|
146
|
+
slice.sliceStart === slice.sliceEnd
|
|
147
|
+
? `Line ${slice.sliceStart}`
|
|
148
|
+
: `Lines ${slice.sliceStart}–${slice.sliceEnd}`;
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div style={{ display: 'flex', flexDirection: 'column', minHeight: 0 }}>
|
|
152
|
+
<div
|
|
153
|
+
style={{
|
|
154
|
+
padding: '4px 14px 6px',
|
|
155
|
+
fontFamily: theme.fonts.monospace,
|
|
156
|
+
fontSize: theme.fontSizes[0],
|
|
157
|
+
color: theme.colors.textSecondary,
|
|
158
|
+
letterSpacing: 0.4,
|
|
159
|
+
textTransform: 'uppercase',
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
{rangeLabel}
|
|
163
|
+
</div>
|
|
164
|
+
<File
|
|
165
|
+
file={fileObject}
|
|
166
|
+
options={options}
|
|
167
|
+
selectedLines={
|
|
168
|
+
slice.focusOffset != null
|
|
169
|
+
? { start: slice.focusOffset, end: slice.focusOffset }
|
|
170
|
+
: undefined
|
|
171
|
+
}
|
|
172
|
+
style={PIERRE_FILE_STYLE}
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { PierreFileView } from './PierreFileView';
|
|
2
|
+
export type { PierreFileViewProps } from './PierreFileView';
|
|
3
|
+
export { PierreSnippetView } from './PierreSnippetView';
|
|
4
|
+
export type { PierreSnippetViewProps } from './PierreSnippetView';
|
|
5
|
+
export { sliceSnippetWindow } from './sliceSnippet';
|
|
6
|
+
export type { SnippetSlice } from './sliceSnippet';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Shared Pierre / @pierre/diffs option helpers for file + snippet views. */
|
|
2
|
+
|
|
3
|
+
export const PIERRE_FILE_STYLE = { display: 'block' } as const;
|
|
4
|
+
|
|
5
|
+
export const PIERRE_BASE_OPTIONS = {
|
|
6
|
+
disableFileHeader: true,
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export function buildBackgroundCSS(background: string): string {
|
|
10
|
+
return `
|
|
11
|
+
:host {
|
|
12
|
+
background: ${background} !important;
|
|
13
|
+
}
|
|
14
|
+
pre, code,
|
|
15
|
+
[data-gutter], [data-content],
|
|
16
|
+
[data-line], [data-column-number],
|
|
17
|
+
[data-gutter-buffer], [data-line-annotation], [data-no-newline],
|
|
18
|
+
[data-separator], [data-separator-wrapper] {
|
|
19
|
+
background: ${background} !important;
|
|
20
|
+
}
|
|
21
|
+
[data-line] span {
|
|
22
|
+
background: ${background} !important;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function buildPierreOptions(background?: string) {
|
|
28
|
+
if (!background) return PIERRE_BASE_OPTIONS;
|
|
29
|
+
return {
|
|
30
|
+
...PIERRE_BASE_OPTIONS,
|
|
31
|
+
unsafeCSS: buildBackgroundCSS(background),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { scrollAnchorLine } from './scrollAnchor';
|
|
3
|
+
|
|
4
|
+
describe('scrollAnchorLine', () => {
|
|
5
|
+
test('first line stays at top', () => {
|
|
6
|
+
expect(scrollAnchorLine(1)).toBe(1);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('focus line keeps a few lines of leading context', () => {
|
|
10
|
+
expect(scrollAnchorLine(10, 4)).toBe(6);
|
|
11
|
+
expect(scrollAnchorLine(3, 4)).toBe(1);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Lines to keep visible above the focus line when scrolling. */
|
|
2
|
+
export const SCROLL_LEADING_LINES = 4;
|
|
3
|
+
|
|
4
|
+
/** 1-based line in the sliced snippet to align near the top of the viewport. */
|
|
5
|
+
export function scrollAnchorLine(
|
|
6
|
+
focusOffset: number,
|
|
7
|
+
leadingLines = SCROLL_LEADING_LINES,
|
|
8
|
+
): number {
|
|
9
|
+
if (focusOffset <= 1) return 1;
|
|
10
|
+
return Math.max(1, focusOffset - leadingLines);
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { sliceSnippetWindow } from './sliceSnippet';
|
|
3
|
+
|
|
4
|
+
describe('sliceSnippetWindow', () => {
|
|
5
|
+
const content = ['line1', 'line2', 'line3', 'line4', 'line5'].join('\n');
|
|
6
|
+
|
|
7
|
+
test('slices with context and focus offset', () => {
|
|
8
|
+
const s = sliceSnippetWindow(content, 3, 3, 1, 3);
|
|
9
|
+
expect(s.sliceStart).toBe(2);
|
|
10
|
+
expect(s.sliceEnd).toBe(4);
|
|
11
|
+
expect(s.contents).toBe(['line2', 'line3', 'line4'].join('\n'));
|
|
12
|
+
expect(s.focusOffset).toBe(2);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('clamps out-of-range lines', () => {
|
|
16
|
+
const s = sliceSnippetWindow(content, 99, 99, 0, 99);
|
|
17
|
+
expect(s.sliceStart).toBe(5);
|
|
18
|
+
expect(s.sliceEnd).toBe(5);
|
|
19
|
+
expect(s.focusOffset).toBe(95);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Slice a file's line range with surrounding context for snippet rendering. */
|
|
2
|
+
|
|
3
|
+
export interface SnippetSlice {
|
|
4
|
+
contents: string;
|
|
5
|
+
sliceStart: number;
|
|
6
|
+
sliceEnd: number;
|
|
7
|
+
/** 1-based line index within `contents` to highlight, or null. */
|
|
8
|
+
focusOffset: number | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function sliceSnippetWindow(
|
|
12
|
+
contents: string,
|
|
13
|
+
startLine: number,
|
|
14
|
+
endLine: number,
|
|
15
|
+
contextLines: number,
|
|
16
|
+
focusLine?: number | null,
|
|
17
|
+
): SnippetSlice {
|
|
18
|
+
const allLines = contents.split('\n');
|
|
19
|
+
const total = allLines.length;
|
|
20
|
+
const safeStart = Math.max(1, Math.min(startLine, total));
|
|
21
|
+
const safeEnd = Math.max(safeStart, Math.min(endLine, total));
|
|
22
|
+
const sliceStart = Math.max(1, safeStart - contextLines);
|
|
23
|
+
const sliceEnd = Math.min(total, safeEnd + contextLines);
|
|
24
|
+
return {
|
|
25
|
+
contents: allLines.slice(sliceStart - 1, sliceEnd).join('\n'),
|
|
26
|
+
sliceStart,
|
|
27
|
+
sliceEnd,
|
|
28
|
+
focusOffset:
|
|
29
|
+
focusLine == null ? null : Math.max(1, focusLine - sliceStart + 1),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -3,8 +3,12 @@ import '@xyflow/react/dist/style.css';
|
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
import { ThemeProvider, defaultTheme, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
5
5
|
import { SubsystemComponentGraph } from '../subsystem/SubsystemComponentGraph';
|
|
6
|
+
import { PierreFileView, PierreSnippetView } from '../pierre';
|
|
6
7
|
import type { SubsystemComponent, SubsystemComponentEdge } from '../subsystem/model';
|
|
8
|
+
import type { SubsystemOpenFileOptions } from '../subsystem/declarationRef';
|
|
7
9
|
import type { GraphifyComponentDetail } from '../graphify';
|
|
10
|
+
import componentDeclarationSource from '../subsystem/ComponentDeclaration.tsx?raw';
|
|
11
|
+
import resolveSource from '../graphify/resolve.ts?raw';
|
|
8
12
|
const meta = {
|
|
9
13
|
title: 'Subsystem/Component Graph',
|
|
10
14
|
component: SubsystemComponentGraph,
|
|
@@ -1127,3 +1131,95 @@ function MultiRepoDemo() {
|
|
|
1127
1131
|
export const MultiRepoTrees: Story = {
|
|
1128
1132
|
render: () => <MultiRepoDemo />,
|
|
1129
1133
|
};
|
|
1134
|
+
|
|
1135
|
+
// ---------------------------------------------------------------------------
|
|
1136
|
+
// Declaration line open — Pierre snippet/file views + declarationRef.
|
|
1137
|
+
// Click the ComponentDeclaration node → toggle file → click path or L251.
|
|
1138
|
+
// ---------------------------------------------------------------------------
|
|
1139
|
+
const storyFileContents: Record<string, string> = {
|
|
1140
|
+
'packages/react/src/subsystem/ComponentDeclaration.tsx': componentDeclarationSource,
|
|
1141
|
+
'packages/react/src/graphify/resolve.ts': resolveSource,
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
const declarationOpenComponents: SubsystemComponent[] = [
|
|
1145
|
+
{
|
|
1146
|
+
id: 'detail',
|
|
1147
|
+
name: 'ComponentDeclaration',
|
|
1148
|
+
kind: 'module',
|
|
1149
|
+
file: 'packages/react/src/subsystem/ComponentDeclaration.tsx',
|
|
1150
|
+
purl: 'pkg:github/principal-ai/principal-view-core-library',
|
|
1151
|
+
purpose: 'declaration panel — click file or L251 to open the drawer at the export line',
|
|
1152
|
+
symbol: 'ComponentDeclaration',
|
|
1153
|
+
declarationRef: {
|
|
1154
|
+
file: 'packages/react/src/subsystem/ComponentDeclaration.tsx',
|
|
1155
|
+
startLine: 251,
|
|
1156
|
+
lineHash: 'storybook-placeholder',
|
|
1157
|
+
capturedAt: new Date(0).toISOString(),
|
|
1158
|
+
},
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
id: 'resolver',
|
|
1162
|
+
name: 'resolve.ts',
|
|
1163
|
+
kind: 'module',
|
|
1164
|
+
file: 'packages/react/src/graphify/resolve.ts',
|
|
1165
|
+
purl: 'pkg:github/principal-ai/principal-view-core-library',
|
|
1166
|
+
purpose: 'graphify type-ref resolver (second file for tree navigation)',
|
|
1167
|
+
symbol: 'resolveGraphifyTypeRef',
|
|
1168
|
+
declarationRef: {
|
|
1169
|
+
file: 'packages/react/src/graphify/resolve.ts',
|
|
1170
|
+
startLine: 1,
|
|
1171
|
+
lineHash: 'storybook-placeholder',
|
|
1172
|
+
capturedAt: new Date(0).toISOString(),
|
|
1173
|
+
},
|
|
1174
|
+
},
|
|
1175
|
+
];
|
|
1176
|
+
|
|
1177
|
+
function readStoryFile(path: string): Promise<string> {
|
|
1178
|
+
const content = storyFileContents[path];
|
|
1179
|
+
if (content == null) {
|
|
1180
|
+
return Promise.reject(new Error(`No story fixture for ${path}`));
|
|
1181
|
+
}
|
|
1182
|
+
return Promise.resolve(content);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
function DeclarationLineOpenDemo() {
|
|
1186
|
+
const renderFileViewer = (file: string, opts?: SubsystemOpenFileOptions) => {
|
|
1187
|
+
const startLine = opts?.startLine;
|
|
1188
|
+
if (startLine != null) {
|
|
1189
|
+
return (
|
|
1190
|
+
<PierreSnippetView
|
|
1191
|
+
filePath={file}
|
|
1192
|
+
fileName={file.split('/').pop() ?? file}
|
|
1193
|
+
startLine={startLine}
|
|
1194
|
+
endLine={startLine}
|
|
1195
|
+
focusLine={startLine}
|
|
1196
|
+
contextLines={40}
|
|
1197
|
+
readFile={readStoryFile}
|
|
1198
|
+
/>
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
return (
|
|
1202
|
+
<PierreFileView
|
|
1203
|
+
filePath={file}
|
|
1204
|
+
fileName={file.split('/').pop() ?? file}
|
|
1205
|
+
readFile={readStoryFile}
|
|
1206
|
+
/>
|
|
1207
|
+
);
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
return (
|
|
1211
|
+
<div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
1212
|
+
<SubsystemComponentGraph
|
|
1213
|
+
title="Declaration line open (Storybook)"
|
|
1214
|
+
description="Uses bundled ?raw fixtures + PierreSnippetView from this package. Select ComponentDeclaration, toggle file, click the path or L251."
|
|
1215
|
+
components={declarationOpenComponents}
|
|
1216
|
+
edges={[]}
|
|
1217
|
+
renderFileViewer={renderFileViewer}
|
|
1218
|
+
/>
|
|
1219
|
+
</div>
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
export const DeclarationLineOpen: Story = {
|
|
1224
|
+
render: () => <DeclarationLineOpenDemo />,
|
|
1225
|
+
};
|
|
@@ -37,6 +37,7 @@ import { IndustryMarkdownSlide } from 'themed-markdown';
|
|
|
37
37
|
import {
|
|
38
38
|
buildSubsystemGraph,
|
|
39
39
|
MECHANISM_COLOR,
|
|
40
|
+
subsystemGraphLayoutKey,
|
|
40
41
|
type SubsystemComponentEdge,
|
|
41
42
|
type SubsystemComponent,
|
|
42
43
|
type SubsystemEdgeMechanism,
|
|
@@ -163,19 +164,30 @@ function Inner({ components, edges, onSelect, onEdgeSelect, measured: _measured,
|
|
|
163
164
|
}, [components, selected]);
|
|
164
165
|
|
|
165
166
|
// Pass 1: build with estimated widths so React Flow can measure the DOM.
|
|
166
|
-
// The pane stays hidden until Pass 2 completes.
|
|
167
|
+
// The pane stays hidden until Pass 2 completes. Key off layout-affecting
|
|
168
|
+
// fields only — declarationRef updates after verify must not re-run ELK.
|
|
169
|
+
const layoutKey = useMemo(
|
|
170
|
+
() => subsystemGraphLayoutKey({ components, edges }),
|
|
171
|
+
[components, edges],
|
|
172
|
+
);
|
|
173
|
+
const componentsRef = useRef(components);
|
|
174
|
+
const edgesRef = useRef(edges);
|
|
175
|
+
componentsRef.current = components;
|
|
176
|
+
edgesRef.current = edges;
|
|
177
|
+
|
|
167
178
|
useEffect(() => {
|
|
168
179
|
let alive = true;
|
|
169
180
|
pass2DoneRef.current = false;
|
|
170
181
|
measuredDimsRef.current = new Map();
|
|
171
182
|
prevMeasuredSigRef.current = '';
|
|
172
|
-
|
|
183
|
+
const doc = { components: componentsRef.current, edges: edgesRef.current };
|
|
184
|
+
void buildSubsystemGraph(doc, { maxNodeWidth, showEdgeLabels }).then(({ nodes, edges: e }) => {
|
|
173
185
|
if (!alive) return;
|
|
174
186
|
setBuilt({ nodes, edges: e as Edge[] });
|
|
175
187
|
setLayoutReady(false);
|
|
176
188
|
});
|
|
177
189
|
return () => { alive = false; };
|
|
178
|
-
}, [
|
|
190
|
+
}, [layoutKey, maxNodeWidth, showEdgeLabels]);
|
|
179
191
|
|
|
180
192
|
// Track measured dimensions from React Flow's dimension changes.
|
|
181
193
|
// These arrive as { type: 'dimensions', id, dimensions } in onNodesChange.
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
deriveNameFromSymbol,
|
|
7
7
|
formatPurl,
|
|
8
8
|
packageColor,
|
|
9
|
+
subsystemGraphLayoutKey,
|
|
9
10
|
} from './model';
|
|
10
11
|
import type { SubsystemComponent, SubsystemComponentEdge } from './model';
|
|
11
12
|
|
|
@@ -87,4 +88,25 @@ describe('subsystem graph model', () => {
|
|
|
87
88
|
// Malformed purls pass through untouched.
|
|
88
89
|
expect(formatPurl('not-a-purl')).toBe('not-a-purl');
|
|
89
90
|
});
|
|
91
|
+
|
|
92
|
+
test('subsystemGraphLayoutKey ignores declarationRef-only changes', () => {
|
|
93
|
+
const base = { components: comps, edges };
|
|
94
|
+
const withRef = {
|
|
95
|
+
components: comps.map((c, i) =>
|
|
96
|
+
i === 0
|
|
97
|
+
? {
|
|
98
|
+
...c,
|
|
99
|
+
declarationRef: {
|
|
100
|
+
file: c.file,
|
|
101
|
+
startLine: 42,
|
|
102
|
+
lineHash: 'abc',
|
|
103
|
+
capturedAt: new Date(0).toISOString(),
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
: c,
|
|
107
|
+
),
|
|
108
|
+
edges,
|
|
109
|
+
};
|
|
110
|
+
expect(subsystemGraphLayoutKey(base)).toBe(subsystemGraphLayoutKey(withRef));
|
|
111
|
+
});
|
|
90
112
|
});
|