@atolis-hq/corum 0.1.28 → 0.1.30
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/src/web/server.js +9 -2
- package/package.json +1 -1
- package/web/graph-utils.js +47 -12
- package/web/graph-utils.test.js +60 -0
- package/web/graph.jsx +76 -19
- package/web/style.css +49 -46
package/dist/src/web/server.js
CHANGED
|
@@ -359,15 +359,22 @@ export function createApp(graph, reloadEvents = createReloadEvents(), source, mu
|
|
|
359
359
|
for (const node of targetGraph.nodesById.values()) {
|
|
360
360
|
if (GRAPH_EXCLUDED_TEMPLATES.has(node.template))
|
|
361
361
|
continue;
|
|
362
|
+
const ownership = getNavigationOwnership(targetGraph, node);
|
|
362
363
|
nodes.push({
|
|
363
364
|
id: node.id,
|
|
364
365
|
template: node.template,
|
|
365
366
|
component: node.component,
|
|
366
367
|
state: node.state,
|
|
367
368
|
stability: node.stability,
|
|
369
|
+
parentId: ownership?.parentId ?? null,
|
|
368
370
|
});
|
|
369
371
|
}
|
|
370
372
|
const nodeIds = new Set(nodes.map(n => n.id));
|
|
373
|
+
// Clear parentId when the parent itself was excluded from the graph
|
|
374
|
+
for (const n of nodes) {
|
|
375
|
+
if (n.parentId && !nodeIds.has(n.parentId))
|
|
376
|
+
n.parentId = null;
|
|
377
|
+
}
|
|
371
378
|
const edges = [];
|
|
372
379
|
for (const edgeList of targetGraph.edgesByFrom.values()) {
|
|
373
380
|
for (const edge of edgeList) {
|
|
@@ -407,8 +414,8 @@ export function createApp(graph, reloadEvents = createReloadEvents(), source, mu
|
|
|
407
414
|
nodesWithEdges.add(edge.to);
|
|
408
415
|
}
|
|
409
416
|
}
|
|
410
|
-
const orphanNodeCount = [...targetGraph.nodesById.
|
|
411
|
-
.filter(
|
|
417
|
+
const orphanNodeCount = [...targetGraph.nodesById.values()]
|
|
418
|
+
.filter(node => !nodesWithEdges.has(node.id) && getNavigationOwnership(targetGraph, node) === undefined).length;
|
|
412
419
|
res.json({
|
|
413
420
|
nodeCount: targetGraph.nodesById.size,
|
|
414
421
|
componentCount: components.size,
|
package/package.json
CHANGED
package/web/graph-utils.js
CHANGED
|
@@ -41,24 +41,59 @@ function buildComponentMap(nodes, edges) {
|
|
|
41
41
|
function buildFocusGraph(focalNodeId, nodes, edges, depth) {
|
|
42
42
|
const nodeById = new Map(nodes.map(n => [n.id, n]));
|
|
43
43
|
const visited = new Set([focalNodeId]);
|
|
44
|
-
const queue = [{ id: focalNodeId, d: 0 }];
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
// All depths use directed two-pass BFS (downstream + upstream separately).
|
|
46
|
+
// Undirected BFS lets upstream nodes "switch direction" and pull in sibling
|
|
47
|
+
// chains — nodes that share an ancestor or descendant but are not in the
|
|
48
|
+
// focal node's own lineage.
|
|
49
|
+
//
|
|
50
|
+
// parentId is an upstream relationship: an owned operation has no semantic
|
|
51
|
+
// edges of its own, so climbing to the parent aggregate is the only way to
|
|
52
|
+
// reach the edges that connect it to the wider graph. parentId traversal
|
|
53
|
+
// belongs in the upstream pass only; adding it to the downstream pass would
|
|
54
|
+
// re-introduce the same sideways crawl via the aggregate's other children.
|
|
55
|
+
|
|
56
|
+
const downQueue = [{ id: focalNodeId, d: 0 }];
|
|
57
|
+
while (downQueue.length > 0) {
|
|
58
|
+
const item = downQueue.shift();
|
|
59
|
+
const id = item.id;
|
|
60
|
+
if (item.d >= depth) continue;
|
|
61
|
+
for (const edge of edges) {
|
|
62
|
+
if (edge.from === id && !visited.has(edge.to) && nodeById.has(edge.to)) {
|
|
63
|
+
visited.add(edge.to);
|
|
64
|
+
downQueue.push({ id: edge.to, d: item.d + 1 });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const upQueue = [{ id: focalNodeId, d: 0 }];
|
|
70
|
+
while (upQueue.length > 0) {
|
|
71
|
+
const item = upQueue.shift();
|
|
72
|
+
const id = item.id;
|
|
73
|
+
if (item.d >= depth) continue;
|
|
49
74
|
for (const edge of edges) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
if (edge.to === id && !visited.has(edge.from) && nodeById.has(edge.from)) {
|
|
76
|
+
visited.add(edge.from);
|
|
77
|
+
upQueue.push({ id: edge.from, d: item.d + 1 });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const pid = nodeById.get(id)?.parentId;
|
|
81
|
+
if (pid && !visited.has(pid) && nodeById.has(pid)) {
|
|
82
|
+
visited.add(pid);
|
|
83
|
+
upQueue.push({ id: pid, d: item.d + 1 });
|
|
56
84
|
}
|
|
57
85
|
}
|
|
58
86
|
|
|
87
|
+
const visibleEdges = edges.filter(e => visited.has(e.from) && visited.has(e.to));
|
|
88
|
+
const visibleNodeIds = new Set([focalNodeId]);
|
|
89
|
+
for (const edge of visibleEdges) {
|
|
90
|
+
visibleNodeIds.add(edge.from);
|
|
91
|
+
visibleNodeIds.add(edge.to);
|
|
92
|
+
}
|
|
93
|
+
|
|
59
94
|
return {
|
|
60
|
-
nodes: [...
|
|
61
|
-
edges:
|
|
95
|
+
nodes: [...visibleNodeIds].map(id => nodeById.get(id)).filter(Boolean),
|
|
96
|
+
edges: visibleEdges,
|
|
62
97
|
};
|
|
63
98
|
}
|
|
64
99
|
|
package/web/graph-utils.test.js
CHANGED
|
@@ -51,6 +51,66 @@ const { buildComponentMap, buildFocusGraph, applyEdgeTypeFilter, getDisplayName
|
|
|
51
51
|
assert(focusAll.nodes.length === 4, 'buildFocusGraph depth=Infinity: includes all reachable nodes');
|
|
52
52
|
assert(focusAll.edges.length === 3, 'buildFocusGraph depth=Infinity: includes all reachable edges');
|
|
53
53
|
|
|
54
|
+
// buildFocusGraph - depth Infinity directed lineage (no sideways crawl)
|
|
55
|
+
// ordersApi → order and ordersApi → paymentsApi → payment
|
|
56
|
+
// Focusing on payment: upstream = {paymentsApi, ordersApi}, downstream = {}
|
|
57
|
+
// order must NOT appear — it's downstream of ordersApi but not in payment's lineage
|
|
58
|
+
const focusPayment = buildFocusGraph('payments.DomainModel.payment', nodes, edges, Infinity);
|
|
59
|
+
assert(focusPayment.nodes.length === 3, 'buildFocusGraph depth=Infinity directed: excludes sideways nodes');
|
|
60
|
+
assert(!focusPayment.nodes.some(n => n.id === 'orders.DomainModel.order'), 'buildFocusGraph depth=Infinity directed: sibling branch excluded');
|
|
61
|
+
assert(focusPayment.nodes.some(n => n.id === 'orders.RestAPI.ordersApi'), 'buildFocusGraph depth=Infinity directed: upstream root included');
|
|
62
|
+
|
|
63
|
+
// buildFocusGraph - directed BFS + parentId traversal (upstream pass only)
|
|
64
|
+
// op --produces--> event (op is upstream of event)
|
|
65
|
+
// op.parentId = agg
|
|
66
|
+
// agg --reads--> tgt (tgt is sideways — downstream of agg only)
|
|
67
|
+
//
|
|
68
|
+
// From event, upstream directed BFS: event ← op (d=1) ← agg (d=2 via parentId).
|
|
69
|
+
// tgt must NOT appear at any depth: only reachable via a downstream edge from agg,
|
|
70
|
+
// which the upstream pass never follows.
|
|
71
|
+
const parentNodes = [
|
|
72
|
+
{ id: 'b.Event.e', template: 'DomainEvent', component: 'b', state: 'agreed', stability: 'stable', parentId: null },
|
|
73
|
+
{ id: 'z.DomainModel.root', template: 'DomainModel', component: 'z', state: 'agreed', stability: 'stable', parentId: null },
|
|
74
|
+
{ id: 'a.DomainModel.agg', template: 'DomainModel', component: 'a', state: 'agreed', stability: 'stable', parentId: null },
|
|
75
|
+
{ id: 'a.DomainModel.agg.operations.op', template: 'DomainOperation', component: 'a', state: 'agreed', stability: 'stable', parentId: 'a.DomainModel.agg' },
|
|
76
|
+
{ id: 'c.DomainModel.tgt', template: 'DomainModel', component: 'c', state: 'agreed', stability: 'stable', parentId: null },
|
|
77
|
+
];
|
|
78
|
+
const parentEdges = [
|
|
79
|
+
{ id: 'p1', from: 'a.DomainModel.agg.operations.op', to: 'b.Event.e', type: 'produces' },
|
|
80
|
+
{ id: 'p0', from: 'z.DomainModel.root', to: 'a.DomainModel.agg', type: 'reads' },
|
|
81
|
+
{ id: 'p2', from: 'a.DomainModel.agg', to: 'c.DomainModel.tgt', type: 'reads' },
|
|
82
|
+
];
|
|
83
|
+
const fp1 = buildFocusGraph('b.Event.e', parentNodes, parentEdges, 1);
|
|
84
|
+
assert(fp1.nodes.some(n => n.id === 'a.DomainModel.agg.operations.op'), 'parentId: depth=1 includes producing op (upstream)');
|
|
85
|
+
assert(!fp1.nodes.some(n => n.id === 'a.DomainModel.agg'), 'parentId: depth=1 does not yet include aggregate');
|
|
86
|
+
const fp2 = buildFocusGraph('b.Event.e', parentNodes, parentEdges, 2);
|
|
87
|
+
assert(!fp2.nodes.some(n => n.id === 'a.DomainModel.agg'), 'parentId: depth=2 prunes aggregate when it has no surviving semantic edge');
|
|
88
|
+
assert(!fp2.nodes.some(n => n.id === 'c.DomainModel.tgt'), 'parentId: depth=2 excludes sideways tgt');
|
|
89
|
+
const fp3 = buildFocusGraph('b.Event.e', parentNodes, parentEdges, 3);
|
|
90
|
+
assert(fp3.nodes.some(n => n.id === 'z.DomainModel.root'), 'parentId: depth=3 still uses aggregate traversal to reach upstream root');
|
|
91
|
+
assert(!fp3.nodes.some(n => n.id === 'c.DomainModel.tgt'), 'parentId: depth=3 still excludes sideways tgt (directed)');
|
|
92
|
+
|
|
93
|
+
// buildFocusGraph - Infinity keeps the same upstream parentId traversal
|
|
94
|
+
const fpInf = buildFocusGraph('b.Event.e', parentNodes, parentEdges, Infinity);
|
|
95
|
+
assert(fpInf.nodes.some(n => n.id === 'a.DomainModel.agg.operations.op'), 'parentId: Infinity follows semantic edges to op');
|
|
96
|
+
assert(fpInf.nodes.some(n => n.id === 'z.DomainModel.root'), 'parentId: Infinity climbs through parent aggregate to upstream root');
|
|
97
|
+
assert(fpInf.nodes.some(n => n.id === 'a.DomainModel.agg'), 'parentId: Infinity keeps aggregate once it participates in a surviving semantic edge');
|
|
98
|
+
assert(!fpInf.nodes.some(n => n.id === 'c.DomainModel.tgt'), 'parentId: Infinity still excludes aggregate sideways connections');
|
|
99
|
+
|
|
100
|
+
// buildFocusGraph - climbed parent without a surviving semantic edge is pruned
|
|
101
|
+
const orphanParentNodes = [
|
|
102
|
+
{ id: 'payruns.DomainEvent.finalised', template: 'DomainEvent', component: 'payruns', state: 'agreed', stability: 'stable', parentId: null },
|
|
103
|
+
{ id: 'payruns.DomainModel.PayRunAggregate', template: 'DomainModel', component: 'payruns', state: 'agreed', stability: 'stable', parentId: null },
|
|
104
|
+
{ id: 'payruns.DomainModel.PayRunAggregate.operations.Finalise', template: 'DomainOperation', component: 'payruns', state: 'agreed', stability: 'stable', parentId: 'payruns.DomainModel.PayRunAggregate' },
|
|
105
|
+
];
|
|
106
|
+
const orphanParentEdges = [
|
|
107
|
+
{ id: 'o1', from: 'payruns.DomainModel.PayRunAggregate.operations.Finalise', to: 'payruns.DomainEvent.finalised', type: 'produces' },
|
|
108
|
+
];
|
|
109
|
+
const orphanParentFocus = buildFocusGraph('payruns.DomainEvent.finalised', orphanParentNodes, orphanParentEdges, 2);
|
|
110
|
+
assert(orphanParentFocus.nodes.some(n => n.id === 'payruns.DomainModel.PayRunAggregate.operations.Finalise'), 'prune orphan parent: producing op remains visible');
|
|
111
|
+
assert(!orphanParentFocus.nodes.some(n => n.id === 'payruns.DomainModel.PayRunAggregate'), 'prune orphan parent: aggregate without surviving edge is omitted');
|
|
112
|
+
assert(orphanParentFocus.edges.length === 1, 'prune orphan parent: semantic edge remains intact');
|
|
113
|
+
|
|
54
114
|
// applyEdgeTypeFilter
|
|
55
115
|
const filtered = applyEdgeTypeFilter(edges, new Set(['reads']));
|
|
56
116
|
assert(filtered.length === 2, 'applyEdgeTypeFilter: keeps only matching type');
|
package/web/graph.jsx
CHANGED
|
@@ -30,9 +30,10 @@ const EDGE_PILL_STYLES = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const ALL_EDGE_TYPES = ['triggers', 'produces', 'reads', 'calls', 'implements', 'maps-to', 'derived-from'];
|
|
33
|
+
const DEPTH_STEPS = [1, 2, 3, 4, 5, Infinity];
|
|
33
34
|
|
|
34
35
|
const NODE_W = 210;
|
|
35
|
-
const NODE_H =
|
|
36
|
+
const NODE_H = 100;
|
|
36
37
|
const COMP_W = 180;
|
|
37
38
|
const COMP_H = 72;
|
|
38
39
|
|
|
@@ -81,6 +82,7 @@ function buildRFNodesForNodes(graphNodes, templateMap, onNodeClick, viewingRef)
|
|
|
81
82
|
return graphNodes.map(n => {
|
|
82
83
|
const tmpl = templateMap.get(n.template);
|
|
83
84
|
const colour = tmpl?.ui?.colour ?? 'var(--ink-4)';
|
|
85
|
+
const parentLabel = n.parentId ? getDisplayName(n.parentId) : null;
|
|
84
86
|
return {
|
|
85
87
|
id: n.id,
|
|
86
88
|
type: 'nodeCard',
|
|
@@ -95,6 +97,7 @@ function buildRFNodesForNodes(graphNodes, templateMap, onNodeClick, viewingRef)
|
|
|
95
97
|
stability: n.stability,
|
|
96
98
|
onClick: () => onNodeClick(n.id),
|
|
97
99
|
viewingRef,
|
|
100
|
+
parentLabel,
|
|
98
101
|
},
|
|
99
102
|
};
|
|
100
103
|
});
|
|
@@ -121,18 +124,23 @@ function NodeCardNode({ data }) {
|
|
|
121
124
|
const colour = data.colour ?? 'var(--ink-4)';
|
|
122
125
|
return (
|
|
123
126
|
<div className="graph-node-card" onClick={data.onClick}>
|
|
127
|
+
{data.parentLabel && (
|
|
128
|
+
<div className="graph-node-card-owner">{data.parentLabel}</div>
|
|
129
|
+
)}
|
|
124
130
|
<RF.Handle type="target" position={RF.Position.Left} style={{ opacity: 0 }} />
|
|
125
131
|
<div className="graph-node-card-bar" style={{ background: colour }} />
|
|
126
|
-
<div className="graph-node-card-header">
|
|
127
|
-
<TemplateBadge name={data.templateLabel} colour={colour} />
|
|
128
|
-
<StateTag state={data.state} />
|
|
129
|
-
</div>
|
|
130
132
|
<div className="graph-node-card-body">
|
|
131
|
-
<div className="graph-node-card-
|
|
132
|
-
|
|
133
|
+
<div className="graph-node-card-text">
|
|
134
|
+
<div className="graph-node-card-name" title={data.nodeId}>{data.label}</div>
|
|
135
|
+
<div className="graph-node-card-component">{data.component}</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div className="graph-node-card-type">
|
|
138
|
+
<TemplateBadge name={data.templateLabel} colour={colour} />
|
|
139
|
+
</div>
|
|
133
140
|
</div>
|
|
134
141
|
<div className="graph-node-card-footer">
|
|
135
142
|
<StabilityTag stability={data.stability} />
|
|
143
|
+
<StateTag state={data.state} />
|
|
136
144
|
<button
|
|
137
145
|
className="graph-node-card-link"
|
|
138
146
|
title="View node details"
|
|
@@ -212,16 +220,18 @@ function GraphToolbar({ visibleEdgeTypes, onToggleEdgeType, showMinimap, onToggl
|
|
|
212
220
|
<div className="graph-toolbar-sep" />
|
|
213
221
|
{level === 'focus' && (
|
|
214
222
|
<>
|
|
215
|
-
<div className="graph-depth-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
<div className="graph-depth-ctrl">
|
|
224
|
+
<button
|
|
225
|
+
className="graph-depth-btn"
|
|
226
|
+
onClick={() => onDepth(DEPTH_STEPS[DEPTH_STEPS.indexOf(depth) - 1])}
|
|
227
|
+
disabled={depth === DEPTH_STEPS[0]}
|
|
228
|
+
>−</button>
|
|
229
|
+
<span className="graph-depth-val">{depth === Infinity ? '∞' : depth}</span>
|
|
230
|
+
<button
|
|
231
|
+
className="graph-depth-btn"
|
|
232
|
+
onClick={() => onDepth(DEPTH_STEPS[DEPTH_STEPS.indexOf(depth) + 1])}
|
|
233
|
+
disabled={depth === DEPTH_STEPS[DEPTH_STEPS.length - 1]}
|
|
234
|
+
>+</button>
|
|
225
235
|
</div>
|
|
226
236
|
<div className="graph-focus-search" ref={searchRef}>
|
|
227
237
|
<input
|
|
@@ -260,8 +270,11 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
260
270
|
const [error, setError] = useState(null);
|
|
261
271
|
const [visibleEdgeTypes, setVisibleEdgeTypes] = useState(loadVisibleEdgeTypes);
|
|
262
272
|
const [showMinimap, setShowMinimap] = useState(false);
|
|
263
|
-
const [depth, setDepth] = useState(
|
|
273
|
+
const [depth, setDepth] = useState(2);
|
|
264
274
|
const [layoutKey, setLayoutKey] = useState(0);
|
|
275
|
+
const [reactFlowInstance, setReactFlowInstance] = useState(null);
|
|
276
|
+
const pendingViewportRef = useRef(null);
|
|
277
|
+
const lastFocusedNodeIdRef = useRef(null);
|
|
265
278
|
const [rfNodes, setRfNodes, onNodesChange] = useNodesState([]);
|
|
266
279
|
const [rfEdges, setRfEdges, onEdgesChange] = useEdgesState([]);
|
|
267
280
|
|
|
@@ -323,6 +336,7 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
323
336
|
|
|
324
337
|
useEffect(() => {
|
|
325
338
|
if (level !== 'component' || !level1) return;
|
|
339
|
+
pendingViewportRef.current = { type: 'full' };
|
|
326
340
|
setRfNodes(level1.rfN);
|
|
327
341
|
setRfEdges(level1.rfE);
|
|
328
342
|
}, [level, level1]);
|
|
@@ -354,10 +368,16 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
354
368
|
|
|
355
369
|
useEffect(() => {
|
|
356
370
|
if (level !== 'interior' || !level2) return;
|
|
371
|
+
pendingViewportRef.current = { type: 'full' };
|
|
357
372
|
setRfNodes(level2.rfN);
|
|
358
373
|
setRfEdges(level2.rfE);
|
|
359
374
|
}, [level, level2]);
|
|
360
375
|
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
if (level === 'focus') return;
|
|
378
|
+
lastFocusedNodeIdRef.current = null;
|
|
379
|
+
}, [level]);
|
|
380
|
+
|
|
361
381
|
// Level 3: node focus
|
|
362
382
|
const level3 = useMemo(() => {
|
|
363
383
|
if (!graphData || !focalNodeId) return null;
|
|
@@ -380,9 +400,45 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
380
400
|
|
|
381
401
|
useEffect(() => {
|
|
382
402
|
if (level !== 'focus' || !level3) return;
|
|
403
|
+
const focalChanged = lastFocusedNodeIdRef.current !== focalNodeId;
|
|
404
|
+
if (focalChanged) {
|
|
405
|
+
pendingViewportRef.current = { type: 'focus', nodeId: focalNodeId };
|
|
406
|
+
}
|
|
407
|
+
lastFocusedNodeIdRef.current = focalNodeId;
|
|
383
408
|
setRfNodes(level3.rfN);
|
|
384
409
|
setRfEdges(level3.rfE);
|
|
385
|
-
}, [level, level3]);
|
|
410
|
+
}, [level, level3, focalNodeId]);
|
|
411
|
+
|
|
412
|
+
useEffect(() => {
|
|
413
|
+
if (!reactFlowInstance || !rfNodes.length) return;
|
|
414
|
+
let frameId = null;
|
|
415
|
+
function fitPendingViewport() {
|
|
416
|
+
const pending = pendingViewportRef.current;
|
|
417
|
+
if (!pending) return;
|
|
418
|
+
if (pending.type === 'focus' && !rfNodes.some(node => node.id === pending.nodeId)) return;
|
|
419
|
+
if (pending.type === 'focus') {
|
|
420
|
+
const measuredNode = reactFlowInstance.getNode(pending.nodeId);
|
|
421
|
+
if (!measuredNode?.width || !measuredNode?.height) {
|
|
422
|
+
frameId = requestAnimationFrame(fitPendingViewport);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
reactFlowInstance.fitView({
|
|
426
|
+
duration: 0,
|
|
427
|
+
padding: 0.2,
|
|
428
|
+
});
|
|
429
|
+
} else {
|
|
430
|
+
reactFlowInstance.fitView({
|
|
431
|
+
duration: 0,
|
|
432
|
+
padding: 0.2,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
pendingViewportRef.current = null;
|
|
436
|
+
}
|
|
437
|
+
frameId = requestAnimationFrame(fitPendingViewport);
|
|
438
|
+
return () => {
|
|
439
|
+
if (frameId !== null) cancelAnimationFrame(frameId);
|
|
440
|
+
};
|
|
441
|
+
}, [reactFlowInstance, rfNodes, rfEdges]);
|
|
386
442
|
|
|
387
443
|
function handleToggleEdgeType(type) {
|
|
388
444
|
setVisibleEdgeTypes(prev => {
|
|
@@ -425,6 +481,7 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
425
481
|
edges={rfEdges}
|
|
426
482
|
onNodesChange={onNodesChange}
|
|
427
483
|
onEdgesChange={onEdgesChange}
|
|
484
|
+
onInit={setReactFlowInstance}
|
|
428
485
|
nodeTypes={nodeTypes}
|
|
429
486
|
fitView
|
|
430
487
|
proOptions={{ hideAttribution: true }}
|
package/web/style.css
CHANGED
|
@@ -1077,28 +1077,38 @@ button {
|
|
|
1077
1077
|
.graph-toolbar-btn:hover { background: var(--paper-2); }
|
|
1078
1078
|
.graph-toolbar-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
|
|
1079
1079
|
|
|
1080
|
-
.graph-depth-
|
|
1080
|
+
.graph-depth-ctrl {
|
|
1081
1081
|
display: flex;
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
border-radius:
|
|
1082
|
+
align-items: center;
|
|
1083
|
+
border: 1px solid var(--rule-2);
|
|
1084
|
+
border-radius: var(--radius);
|
|
1085
1085
|
overflow: hidden;
|
|
1086
1086
|
}
|
|
1087
1087
|
|
|
1088
|
-
.graph-depth-
|
|
1089
|
-
padding:
|
|
1090
|
-
|
|
1091
|
-
|
|
1088
|
+
.graph-depth-btn {
|
|
1089
|
+
padding: 2px 7px;
|
|
1090
|
+
font-size: 14px;
|
|
1091
|
+
line-height: 1;
|
|
1092
1092
|
cursor: pointer;
|
|
1093
|
-
|
|
1094
|
-
font-size: 11px;
|
|
1093
|
+
background: none;
|
|
1095
1094
|
border: none;
|
|
1095
|
+
color: var(--ink-3);
|
|
1096
|
+
font: inherit;
|
|
1096
1097
|
}
|
|
1097
1098
|
|
|
1098
|
-
.graph-depth-
|
|
1099
|
-
|
|
1100
|
-
|
|
1099
|
+
.graph-depth-btn:hover:not(:disabled) { color: var(--ink); background: var(--paper-2); }
|
|
1100
|
+
.graph-depth-btn:disabled { opacity: 0.3; cursor: not-allowed; }
|
|
1101
|
+
|
|
1102
|
+
.graph-depth-val {
|
|
1103
|
+
min-width: 22px;
|
|
1104
|
+
text-align: center;
|
|
1105
|
+
font-size: 11px;
|
|
1101
1106
|
font-weight: 600;
|
|
1107
|
+
color: var(--ink);
|
|
1108
|
+
border-left: 1px solid var(--rule-2);
|
|
1109
|
+
border-right: 1px solid var(--rule-2);
|
|
1110
|
+
padding: 2px 4px;
|
|
1111
|
+
user-select: none;
|
|
1102
1112
|
}
|
|
1103
1113
|
|
|
1104
1114
|
.graph-focus-search {
|
|
@@ -1258,23 +1268,33 @@ button {
|
|
|
1258
1268
|
border-radius: var(--radius) 0 0 var(--radius);
|
|
1259
1269
|
}
|
|
1260
1270
|
|
|
1261
|
-
.graph-node-card-
|
|
1262
|
-
display: flex;
|
|
1263
|
-
align-items: center;
|
|
1264
|
-
gap: 5px;
|
|
1265
|
-
padding: 6px 8px 4px 10px;
|
|
1266
|
-
}
|
|
1271
|
+
.graph-node-card-body { padding: 8px 8px 4px 10px; }
|
|
1267
1272
|
|
|
1268
|
-
.graph-node-card-
|
|
1273
|
+
.graph-node-card-text {
|
|
1274
|
+
min-height: calc((1.25em * 2) + 12px);
|
|
1275
|
+
}
|
|
1269
1276
|
|
|
1270
1277
|
.graph-node-card-name {
|
|
1271
1278
|
font-weight: 600;
|
|
1272
1279
|
font-size: 13px;
|
|
1273
1280
|
color: var(--ink);
|
|
1281
|
+
white-space: normal;
|
|
1282
|
+
overflow: visible;
|
|
1283
|
+
text-overflow: clip;
|
|
1284
|
+
line-height: 1.25;
|
|
1285
|
+
overflow-wrap: anywhere;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
.graph-node-card-owner {
|
|
1289
|
+
position: absolute;
|
|
1290
|
+
top: -16px;
|
|
1291
|
+
left: 8px;
|
|
1292
|
+
font-size: 10px;
|
|
1293
|
+
font-weight: 500;
|
|
1294
|
+
color: var(--ink-3);
|
|
1274
1295
|
white-space: nowrap;
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
max-width: 180px;
|
|
1296
|
+
pointer-events: none;
|
|
1297
|
+
line-height: 1;
|
|
1278
1298
|
}
|
|
1279
1299
|
|
|
1280
1300
|
.graph-node-card-component {
|
|
@@ -1286,16 +1306,21 @@ button {
|
|
|
1286
1306
|
text-overflow: ellipsis;
|
|
1287
1307
|
}
|
|
1288
1308
|
|
|
1309
|
+
.graph-node-card-type {
|
|
1310
|
+
margin-top: 6px;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1289
1313
|
.graph-node-card-footer {
|
|
1290
1314
|
display: flex;
|
|
1291
1315
|
align-items: center;
|
|
1292
|
-
|
|
1316
|
+
gap: 6px;
|
|
1293
1317
|
padding: 3px 8px 5px 10px;
|
|
1294
1318
|
border-top: 1px solid var(--rule);
|
|
1295
1319
|
margin-top: 3px;
|
|
1296
1320
|
}
|
|
1297
1321
|
|
|
1298
1322
|
.graph-node-card-link {
|
|
1323
|
+
margin-left: auto;
|
|
1299
1324
|
color: var(--ink-4);
|
|
1300
1325
|
cursor: pointer;
|
|
1301
1326
|
font-size: 11px;
|
|
@@ -1358,28 +1383,6 @@ button {
|
|
|
1358
1383
|
flex-shrink: 0;
|
|
1359
1384
|
}
|
|
1360
1385
|
|
|
1361
|
-
/* Depth segmented control */
|
|
1362
|
-
.graph-depth-seg {
|
|
1363
|
-
display: flex;
|
|
1364
|
-
border: 1px solid var(--rule-2);
|
|
1365
|
-
border-radius: var(--radius);
|
|
1366
|
-
overflow: hidden;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
.graph-depth-item {
|
|
1370
|
-
padding: 3px 10px;
|
|
1371
|
-
font-size: 11px;
|
|
1372
|
-
font-weight: 500;
|
|
1373
|
-
cursor: pointer;
|
|
1374
|
-
background: none;
|
|
1375
|
-
border: none;
|
|
1376
|
-
border-right: 1px solid var(--rule-2);
|
|
1377
|
-
color: var(--ink-3);
|
|
1378
|
-
font: inherit;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
.graph-depth-item:last-child { border-right: none; }
|
|
1382
|
-
.graph-depth-item.active { background: var(--paper-3); color: var(--ink); }
|
|
1383
1386
|
|
|
1384
1387
|
/* Toolbar buttons */
|
|
1385
1388
|
.graph-toolbar-btn {
|