@principal-ai/principal-view-react 0.16.33 → 0.16.34
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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +3 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +19 -5
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/SubsystemFileTree.d.ts +10 -15
- package/dist/subsystem/SubsystemFileTree.d.ts.map +1 -1
- package/dist/subsystem/SubsystemFileTree.js +96 -93
- package/dist/subsystem/SubsystemFileTree.js.map +1 -1
- package/dist/subsystem/model.d.ts +3 -0
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js.map +1 -1
- package/dist/subsystem/nodes.d.ts +2 -0
- package/dist/subsystem/nodes.d.ts.map +1 -1
- package/dist/subsystem/nodes.js +12 -7
- package/dist/subsystem/nodes.js.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +1 -1
- package/src/stories/SubsystemComponentGraph.stories.tsx +10 -2
- package/src/subsystem/SubsystemComponentGraph.tsx +22 -4
- package/src/subsystem/SubsystemFileTree.tsx +102 -141
- package/src/subsystem/model.ts +3 -0
- package/src/subsystem/nodes.tsx +17 -8
package/src/subsystem/nodes.tsx
CHANGED
|
@@ -50,6 +50,8 @@ export interface SubsystemGraphCallbacks {
|
|
|
50
50
|
onSelect?: (componentId: string) => void;
|
|
51
51
|
/** Click an edge (or its label) — select the relationship. */
|
|
52
52
|
onEdgeSelect?: (edgeId: string) => void;
|
|
53
|
+
/** Hover a component (null on leave) — associates it with the file tree. */
|
|
54
|
+
onHover?: (componentId: string | null) => void;
|
|
53
55
|
/** Upper bound for node width; nodes grow with content up to this, then wrap. */
|
|
54
56
|
maxNodeWidth?: number;
|
|
55
57
|
}
|
|
@@ -70,11 +72,18 @@ export function SubsystemComponentNode(props: NodeProps<SubsystemGraphNode>) {
|
|
|
70
72
|
// Set while a file is open in the drawer: true → spotlight, false → dim,
|
|
71
73
|
// absent (no file open) → neutral.
|
|
72
74
|
const fileMatch = data.fileMatch as boolean | undefined;
|
|
75
|
+
const showFileBadges = data.showFileBadges !== false;
|
|
73
76
|
|
|
74
77
|
return (
|
|
75
78
|
<div
|
|
76
|
-
onMouseEnter={() =>
|
|
77
|
-
|
|
79
|
+
onMouseEnter={() => {
|
|
80
|
+
setHover(true);
|
|
81
|
+
SUBSYSTEM_CALLBACKS.onHover?.(c.id);
|
|
82
|
+
}}
|
|
83
|
+
onMouseLeave={() => {
|
|
84
|
+
setHover(false);
|
|
85
|
+
SUBSYSTEM_CALLBACKS.onHover?.(null);
|
|
86
|
+
}}
|
|
78
87
|
onClick={(e) => {
|
|
79
88
|
e.stopPropagation();
|
|
80
89
|
SUBSYSTEM_CALLBACKS.onSelect?.(c.id);
|
|
@@ -117,7 +126,6 @@ export function SubsystemComponentNode(props: NodeProps<SubsystemGraphNode>) {
|
|
|
117
126
|
whiteSpace: 'nowrap',
|
|
118
127
|
fontSize: theme.fontSizes[0] * 0.8,
|
|
119
128
|
fontFamily: theme.fonts.monospace,
|
|
120
|
-
textTransform: 'uppercase',
|
|
121
129
|
letterSpacing: 0.5,
|
|
122
130
|
color,
|
|
123
131
|
background: theme.colors.background,
|
|
@@ -126,7 +134,10 @@ export function SubsystemComponentNode(props: NodeProps<SubsystemGraphNode>) {
|
|
|
126
134
|
padding: '1px 6px',
|
|
127
135
|
}}
|
|
128
136
|
>
|
|
129
|
-
{
|
|
137
|
+
<span style={{ textTransform: 'uppercase' }}>
|
|
138
|
+
{KIND_LABEL[c.kind] ?? c.kind}
|
|
139
|
+
</span>
|
|
140
|
+
{c.file ? ` · ${c.file.split('/').pop()}` : ''}
|
|
130
141
|
{c.capture && c.capture !== 'edited' ? ` · ${c.capture}` : ''}
|
|
131
142
|
</div>
|
|
132
143
|
)}
|
|
@@ -168,9 +179,7 @@ export function SubsystemComponentNode(props: NodeProps<SubsystemGraphNode>) {
|
|
|
168
179
|
whiteSpace: 'normal',
|
|
169
180
|
overflowWrap: 'anywhere',
|
|
170
181
|
maxWidth: '100%',
|
|
171
|
-
|
|
172
|
-
fontFamily:
|
|
173
|
-
c.kind === 'type' ? 'Georgia, "Times New Roman", serif' : theme.fonts.body,
|
|
182
|
+
fontFamily: theme.fonts.body,
|
|
174
183
|
}}
|
|
175
184
|
>
|
|
176
185
|
{breakWords(displayName)}
|
|
@@ -195,7 +204,7 @@ export function SubsystemComponentNode(props: NodeProps<SubsystemGraphNode>) {
|
|
|
195
204
|
</div>
|
|
196
205
|
)}
|
|
197
206
|
|
|
198
|
-
{c.file && (
|
|
207
|
+
{c.file && showFileBadges && (
|
|
199
208
|
<div
|
|
200
209
|
onClick={(e) => {
|
|
201
210
|
e.stopPropagation();
|