@principal-ai/principal-view-react 0.16.62 → 0.16.64
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/EdgeLegendModal.d.ts.map +1 -1
- package/dist/subsystem/EdgeLegendModal.js +3 -0
- package/dist/subsystem/EdgeLegendModal.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +2 -4
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +43 -52
- package/dist/subsystem/SubsystemComponentGraph.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 +28 -4
- package/dist/subsystem/model.js.map +1 -1
- package/dist/subsystem/nodes.js +3 -3
- package/dist/subsystem/nodes.js.map +1 -1
- package/package.json +1 -1
- package/src/stories/Subsystem/ComponentGraph/GraphTitle.stories.tsx +0 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +73 -80
- package/src/subsystem/model.test.ts +5 -5
- package/src/subsystem/model.ts +29 -4
- package/src/subsystem/nodes.tsx +3 -3
- package/src/subsystem/EdgeLegendModal.tsx +0 -146
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EdgeLegendModal — modal over the graph area showing the edge-mechanism
|
|
3
|
-
* legend (moved out of the sidebar), plus the canonical mechanism
|
|
4
|
-
* descriptions table shared with the canvas's edge-label overlay.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { useEffect } from 'react';
|
|
8
|
-
import { useTheme } from '@principal-ade/industry-theme';
|
|
9
|
-
import { X } from 'lucide-react';
|
|
10
|
-
import { MECHANISM_COLOR, type SubsystemEdgeMechanism } from './model';
|
|
11
|
-
|
|
12
|
-
/** Mechanism → [description, verifiable-with-graphify]. Drives the legend
|
|
13
|
-
* modal and the "not directly verifiable" styling of edge labels. */
|
|
14
|
-
export const MECHANISM_DESCRIPTIONS: [SubsystemEdgeMechanism, string, boolean][] = [
|
|
15
|
-
['imports', 'import statement (code-level dependency)', true],
|
|
16
|
-
['imports_from', 'imported by (reverse dependency)', true],
|
|
17
|
-
['re_exports', 're-exports symbols from', true],
|
|
18
|
-
['defines', 'defines / declares symbol', true],
|
|
19
|
-
['calls', 'function/method call (call graph edge)', true],
|
|
20
|
-
['extends', 'class inheritance', true],
|
|
21
|
-
['inherits', 'class inheritance', true],
|
|
22
|
-
['implements', 'implements interface / protocol', true],
|
|
23
|
-
['mixes_in', 'applies mixin', true],
|
|
24
|
-
['uses', 'general dependency (import, call, or reference)', false],
|
|
25
|
-
['method', 'structural: has method / member', true],
|
|
26
|
-
['references', 'type / symbol reference (not a call)', true],
|
|
27
|
-
['contains', 'structural: contains / encapsulates', true],
|
|
28
|
-
['feeds', 'data flow: output feeds into input', false],
|
|
29
|
-
['produces', 'data flow: produces / outputs', false],
|
|
30
|
-
['registers-into', 'registration pattern', false],
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
/** Modal over the graph area showing the edge-mechanism legend (moved out of
|
|
34
|
-
* the sidebar). Closes on backdrop click or Escape; renders nothing when
|
|
35
|
-
* closed. */
|
|
36
|
-
export function EdgeLegendModal({
|
|
37
|
-
open,
|
|
38
|
-
mechanisms,
|
|
39
|
-
onClose,
|
|
40
|
-
}: {
|
|
41
|
-
open: boolean;
|
|
42
|
-
mechanisms: Set<string>;
|
|
43
|
-
onClose: () => void;
|
|
44
|
-
}) {
|
|
45
|
-
const { theme } = useTheme();
|
|
46
|
-
const muted = theme.colors.textMuted ?? theme.colors.textSecondary;
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (!open) return;
|
|
50
|
-
const onKey = (e: KeyboardEvent) => {
|
|
51
|
-
if (e.key === 'Escape') onClose();
|
|
52
|
-
};
|
|
53
|
-
window.addEventListener('keydown', onKey);
|
|
54
|
-
return () => window.removeEventListener('keydown', onKey);
|
|
55
|
-
}, [open, onClose]);
|
|
56
|
-
|
|
57
|
-
if (!open) return null;
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<div
|
|
61
|
-
onClick={onClose}
|
|
62
|
-
style={{
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
inset: 0,
|
|
65
|
-
zIndex: 20,
|
|
66
|
-
display: 'flex',
|
|
67
|
-
alignItems: 'center',
|
|
68
|
-
justifyContent: 'center',
|
|
69
|
-
background: 'rgba(0,0,0,0.5)',
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<div
|
|
73
|
-
onClick={(e) => e.stopPropagation()}
|
|
74
|
-
style={{
|
|
75
|
-
background: theme.colors.background,
|
|
76
|
-
border: `1px solid ${theme.colors.border}`,
|
|
77
|
-
borderRadius: 8,
|
|
78
|
-
boxShadow: '0 8px 32px rgba(0,0,0,0.4)',
|
|
79
|
-
padding: '16px',
|
|
80
|
-
width: 420,
|
|
81
|
-
maxWidth: '90%',
|
|
82
|
-
maxHeight: '80%',
|
|
83
|
-
overflowY: 'auto',
|
|
84
|
-
fontFamily: theme.fonts.body,
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
<div
|
|
88
|
-
style={{
|
|
89
|
-
display: 'flex',
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
justifyContent: 'space-between',
|
|
92
|
-
marginBottom: 12,
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
<span
|
|
96
|
-
style={{
|
|
97
|
-
fontSize: theme.fontSizes[1],
|
|
98
|
-
fontWeight: 600,
|
|
99
|
-
color: theme.colors.text,
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
Edge Legend
|
|
103
|
-
</span>
|
|
104
|
-
<button
|
|
105
|
-
type="button"
|
|
106
|
-
onClick={onClose}
|
|
107
|
-
aria-label="Close legend"
|
|
108
|
-
style={{
|
|
109
|
-
display: 'inline-flex',
|
|
110
|
-
alignItems: 'center',
|
|
111
|
-
justifyContent: 'center',
|
|
112
|
-
width: 22,
|
|
113
|
-
height: 22,
|
|
114
|
-
padding: 0,
|
|
115
|
-
border: 'none',
|
|
116
|
-
borderRadius: 4,
|
|
117
|
-
background: 'transparent',
|
|
118
|
-
color: theme.colors.text,
|
|
119
|
-
cursor: 'pointer',
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
<X size={14} />
|
|
123
|
-
</button>
|
|
124
|
-
</div>
|
|
125
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
126
|
-
{MECHANISM_DESCRIPTIONS.filter(([m]) => mechanisms.has(m)).map(([mechanism, desc, verifiable]) => (
|
|
127
|
-
<div key={mechanism} style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: theme.fontSizes[0] }}>
|
|
128
|
-
<span
|
|
129
|
-
style={{
|
|
130
|
-
width: 10,
|
|
131
|
-
height: 10,
|
|
132
|
-
borderRadius: verifiable ? '50%' : '30% 70% 70% 30% / 30% 30% 70% 70%',
|
|
133
|
-
background: MECHANISM_COLOR[mechanism],
|
|
134
|
-
border: verifiable ? 'none' : `1px dashed ${MECHANISM_COLOR[mechanism]}`,
|
|
135
|
-
flexShrink: 0,
|
|
136
|
-
}}
|
|
137
|
-
/>
|
|
138
|
-
<span style={{ fontFamily: theme.fonts.monospace, color: MECHANISM_COLOR[mechanism], fontWeight: 500 }}>{mechanism}</span>
|
|
139
|
-
<span style={{ color: muted }}>{desc}</span>
|
|
140
|
-
</div>
|
|
141
|
-
))}
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
);
|
|
146
|
-
}
|